11name : Release
22
33on :
4- release :
5- types : [published]
6- workflow_dispatch :
4+ push :
5+ tags :
6+ - " * "
77
88permissions :
99 contents : write
1010
1111jobs :
12- publish :
13- name : Publish ${{ matrix.rid }}
14- runs-on : ubuntu-latest
12+ build :
13+ name : Build assets ( ${{ matrix.rid }})
14+ runs-on : ${{ matrix.os }}
1515 strategy :
16+ fail-fast : false
1617 matrix :
17- rid : [linux-x64, win-x64, osx-x64]
18+ include :
19+ - os : ubuntu-latest
20+ rid : linux-x64
21+ - os : windows-latest
22+ rid : win-x64
23+ - os : windows-latest
24+ rid : win-x86
25+ - os : macos-latest
26+ rid : osx-x64
27+ - os : macos-latest
28+ rid : osx-arm64
1829
1930 steps :
2031 - name : Checkout
@@ -23,26 +34,70 @@ jobs:
2334 - name : Setup .NET
2435 uses : actions/setup-dotnet@v4
2536 with :
26- dotnet-version : ' 8.0.x'
37+ global-json-file : global.json
38+ cache : true
39+ cache-dependency-path : |
40+ **/*.csproj
2741
2842 - name : Restore
29- working-directory : AmigaRawImageConverter
30- run : dotnet restore
43+ run : dotnet restore AmigaRawImageConverter.sln
44+
45+ - name : Publish (Linux/macOS)
46+ if : runner.os != 'Windows'
47+ env :
48+ RID : ${{ matrix.rid }}
49+ run : |
50+ set -euo pipefail
51+ rm -rf dist
52+ dotnet publish AmigaRawImageConverter/AmigaRawImageConverter.csproj -c Release -r "$RID" --self-contained false -o "dist/$RID/AmigaRawImageConverter"
3153
32- - name : Publish
33- working-directory : AmigaRawImageConverter
54+ - name : Package (Linux/macOS)
55+ if : runner.os != 'Windows'
56+ env :
57+ RID : ${{ matrix.rid }}
3458 run : |
35- dotnet publish -c Release -r ${{ matrix.rid }} \
36- --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true \
37- -o publish/${{ matrix.rid }}
59+ set -euo pipefail
60+ cd "dist/$RID"
61+ zip -r "../../AmigaRawImageConverter-$RID.zip" .
3862
39- - name : Package artifact
40- working-directory : AmigaRawImageConverter/publish/${{ matrix.rid }}
41- run : zip -r ../AmigaRawImageConverter-${{ matrix.rid }}.zip .
63+ - name : Publish (Windows)
64+ if : runner.os == 'Windows'
65+ shell : pwsh
66+ env :
67+ RID : ${{ matrix.rid }}
68+ run : |
69+ Remove-Item -Recurse -Force dist -ErrorAction SilentlyContinue
70+ dotnet publish AmigaRawImageConverter/AmigaRawImageConverter.csproj -c Release -r $env:RID --self-contained false -o dist/$env:RID/AmigaRawImageConverter
4271
43- - name : Upload to release
44- uses : softprops/action-gh-release@v1
45- with :
46- files : AmigaRawImageConverter/publish/AmigaRawImageConverter-${{ matrix.rid }}.zip
72+ - name : Package (Windows)
73+ if : runner.os == 'Windows'
74+ shell : pwsh
4775 env :
48- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
76+ RID : ${{ matrix.rid }}
77+ run : |
78+ Compress-Archive -Path dist/$env:RID/* -DestinationPath AmigaRawImageConverter-$env:RID.zip -Force
79+
80+ - name : Upload asset artifact
81+ uses : actions/upload-artifact@v4
82+ with :
83+ name : release-asset-${{ matrix.rid }}
84+ path : AmigaRawImageConverter-${{ matrix.rid }}.zip
85+
86+ release :
87+ name : Create GitHub Release
88+ runs-on : ubuntu-latest
89+ needs : build
90+
91+ steps :
92+ - name : Download assets
93+ uses : actions/download-artifact@v4
94+ with :
95+ path : release-assets
96+ merge-multiple : true
97+
98+ - name : Publish GitHub release
99+ uses : softprops/action-gh-release@v2
100+ with :
101+ files : release-assets/*.zip
102+ fail_on_unmatched_files : true
103+ generate_release_notes : true
0 commit comments