1- name : Publish
1+ name : Publish
22
33on :
44 workflow_dispatch :
55
66jobs :
7- build :
8- strategy :
9- matrix :
10- os : [ubuntu-latest, windows-latest]
11- include :
12- - os : ubuntu-latest
13- rid : linux-x64
14- ext : " "
15- - os : windows-latest
16- rid : win-x64
17- ext : " .exe"
18- runs-on : ${{ matrix.os }}
7+ build-windows :
8+ runs-on : windows-latest
199 steps :
2010 - uses : actions/checkout@v4
2111
@@ -27,32 +17,62 @@ jobs:
2717 - name : Publish
2818 run : >
2919 dotnet publish src/GeneralUpdate.Tools.csproj
30- -c Release
31- -r ${{ matrix.rid }}
32- -p:PublishSingleFile=true
33- -p:PublishTrimmed=true
34- --self-contained
35- -o publish/${{ matrix.rid }}
20+ -c Release -r win-x64
21+ -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained
22+ -o publish/win-x64
23+
24+ - name : Upload win artifact
25+ uses : actions/upload-artifact@v4
26+ with :
27+ name : GeneralUpdate.Tools-win-x64
28+ path : publish/win-x64/GeneralUpdate.Tools.exe
29+
30+ build-linux :
31+ runs-on : ubuntu-latest
32+ steps :
33+ - uses : actions/checkout@v4
34+
35+ - name : Setup .NET
36+ uses : actions/setup-dotnet@v4
37+ with :
38+ dotnet-version : 10.0.x
39+
40+ - name : Publish
41+ run : >
42+ dotnet publish src/GeneralUpdate.Tools.csproj
43+ -c Release -r linux-x64
44+ -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained
45+ -o publish/linux-x64
46+
47+ - name : Upload linux artifact
48+ uses : actions/upload-artifact@v4
49+ with :
50+ name : GeneralUpdate.Tools-linux-x64
51+ path : publish/linux-x64/GeneralUpdate.Tools
52+
53+ release :
54+ needs : [build-windows, build-linux]
55+ runs-on : ubuntu-latest
56+ permissions :
57+ contents : write
58+ steps :
59+ - uses : actions/download-artifact@v4
3660
3761 - name : Get timestamp
3862 id : ts
39- shell : bash
4063 run : echo "timestamp=$(date -u '+%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
4164
42- - name : Package (Windows)
43- if : matrix.os == 'windows-latest'
44- shell : pwsh
65+ - name : Package zips
4566 run : |
46- Compress-Archive -Path publish/${{ matrix.rid }}/GeneralUpdate.Tools.exe -DestinationPath GeneralUpdate.Tools_${{ steps.ts.outputs.timestamp }}_win-x64.zip
67+ chmod +x GeneralUpdate.Tools-linux-x64/GeneralUpdate.Tools
68+ cd GeneralUpdate.Tools-win-x64 && zip ../../GeneralUpdate.Tools_${{ steps.ts.outputs.timestamp }}_win-x64.zip GeneralUpdate.Tools.exe && cd ..
69+ cd GeneralUpdate.Tools-linux-x64 && zip ../../GeneralUpdate.Tools_${{ steps.ts.outputs.timestamp }}_linux-x64.zip GeneralUpdate.Tools && cd ..
4770
48- - name : Package (Linux)
49- if : matrix.os == 'ubuntu-latest'
50- run : |
51- cd publish/${{ matrix.rid }}
52- zip ../../GeneralUpdate.Tools_${{ steps.ts.outputs.timestamp }}_linux-x64.zip GeneralUpdate.Tools
53-
54- - name : Upload artifact
55- uses : actions/upload-artifact@v4
71+ - name : Create Release
72+ uses : softprops/action-gh-release@v2
5673 with :
57- name : GeneralUpdate.Tools_${{ steps.ts.outputs.timestamp }}_${{ matrix.rid }}
58- path : GeneralUpdate.Tools_${{ steps.ts.outputs.timestamp }}_${{ matrix.rid }}.zip
74+ tag_name : v${{ steps.ts.outputs.timestamp }}
75+ name : Release ${{ steps.ts.outputs.timestamp }}
76+ files : |
77+ GeneralUpdate.Tools_${{ steps.ts.outputs.timestamp }}_win-x64.zip
78+ GeneralUpdate.Tools_${{ steps.ts.outputs.timestamp }}_linux-x64.zip
0 commit comments