-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (98 loc) · 3.62 KB
/
Copy pathrelease.yml
File metadata and controls
98 lines (98 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Release
on:
push:
tags:
- 'v*.*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g. 0.0.0.2)'
required: true
jobs:
release:
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Extract version from tag
id: version
shell: bash
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
fi
- name: Extract changelog for version
id: changelog
shell: pwsh
run: |
$version = '${{ steps.version.outputs.VERSION }}'
$content = Get-Content 'CHANGELOG.md' -Raw
$pattern = "## v$version(.*?)(?=## v|\Z)"
$match = [regex]::Match($content, $pattern, [System.Text.RegularExpressions.RegexOptions]::Singleline)
if ($match.Success) {
$notes = $match.Groups[1].Value.Trim()
} else {
$notes = "See CHANGELOG.md for details."
}
$notes | Out-File -FilePath release_notes.txt -Encoding utf8
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.x'
- name: Download Dalamud
shell: pwsh
run: |
Invoke-WebRequest -Uri https://goatcorp.github.io/dalamud-distrib/latest.zip -OutFile C:\dalamud.zip
Expand-Archive -Force C:\dalamud.zip "$env:AppData\XIVLauncher\addon\Hooks\dev"
- name: Build
run: dotnet build Silkstring/Silkstring.csproj --configuration Release -p:Version=${{ steps.version.outputs.VERSION }} -p:AssemblyVersion=${{ steps.version.outputs.VERSION }}
- name: Create zip
shell: pwsh
run: |
$output = 'Silkstring/bin/Release'
$files = @(
"$output/Silkstring.dll",
"$output/Silkstring.json",
"$output/ECommons.dll",
"$output/Penumbra.Api.dll",
"$output/DalamudTextEdit.dll",
"$output/Silkstring.deps.json",
"$output/images",
"$output/Silkstring"
)
Compress-Archive -Path $files -DestinationPath 'Silkstring.zip'
- name: Update repo.json
shell: pwsh
run: |
$json = Get-Content 'repo.json' | ConvertFrom-Json
$json[0].AssemblyVersion = '${{ steps.version.outputs.VERSION }}'
$json[0].Version = '${{ steps.version.outputs.VERSION }}'
$output = ConvertTo-Json @($json) -Depth 10
Set-Content 'repo.json' $output
- name: Commit repo.json
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add repo.json
git commit -m "bump version to ${{ steps.version.outputs.VERSION }}"
git push origin HEAD:main
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.VERSION }}
files: Silkstring.zip
generate_release_notes: false
body_path: release_notes.txt
- name: Notify Fox's Hollow
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.HOLLOW_PAT }}
repository: devoreofox/foxs-hollow
event-type: plugin-updated
client-payload: '{"plugin": "Silkstring", "version": "${{ steps.version.outputs.VERSION }}"}'