1+ name : Publish Release from Tag
2+
3+ on :
4+ push :
5+ tags :
6+ - " *.*.*-beta*"
7+ - " *.*.*-rc*"
8+
9+ jobs :
10+
11+ build :
12+ name : Build release artifacts
13+ runs-on : ubuntu-latest
14+ strategy :
15+ matrix :
16+ targets :
17+ [
18+ " linux-x64" ,
19+ " linux-musl-x64" ,
20+ " linux-arm" ,
21+ " linux-arm64" ,
22+ " osx-x64" ,
23+ " win-x64" ,
24+ " win-x86" ,
25+ " win-arm" ,
26+ " win-arm64" ,
27+ ]
28+ steps :
29+ - name : Checkout
30+ uses : actions/checkout@v1
31+ - name : Set up .NET Core
32+ uses : actions/setup-dotnet@v1
33+ with :
34+ dotnet-version : " 6.0.x"
35+ - name : Publish .NET app
36+ env :
37+ RID : ${{ matrix.targets }}
38+ VERSION : ${{ github.ref_name }}
39+ run : dotnet publish -c Release -r $RID --self-contained true -p:DebugType=None -p:DebugSymbols=false -p:PublishSingleFile=true CliSample/CliSample.csproj --output /home/runner/work/clis/$RID
40+ - name : Package assets
41+ env :
42+ RID : ${{ matrix.targets }}
43+ VERSION : ${{ github.ref_name }}
44+ run : |
45+ mkdir /home/runner/work/release
46+ ls /home/runner/work/clis/
47+ zip -j /home/runner/work/release/clisample-$VERSION-$RID.zip /home/runner/work/clis/$RID/*
48+ - name : Upload artifacts
49+ uses : actions/upload-artifact@v2
50+ with :
51+ name : clisample-${{ github.ref_name }}-${{ matrix.targets }}.zip
52+ path : " /home/runner/work/release/clisample-${{ github.ref_name }}-${{ matrix.targets }}.zip"
53+
54+ publish :
55+ name : Publish release
56+ needs : build
57+ runs-on : ubuntu-latest
58+ steps :
59+ - name : Checkout
60+ uses : actions/checkout@v1
61+ - name : Create .artifacts dir
62+ run : mkdir .artifacts
63+ - uses : actions/download-artifact@v2
64+ with :
65+ path : .artifacts
66+ - name : Generate Changelog
67+ run : git log --pretty="format:[%h] %s" $(git describe --tags --abbrev=0 @^)..@ > .artifacts/CHANGELOG.txt
68+ - name : Release
69+ uses : softprops/action-gh-release@v1
70+ if : startsWith(github.ref, 'refs/tags/')
71+ with :
72+ prerelease : true
73+ files : .artifacts/**
74+ body_path : .artifacts/CHANGELOG.txt
0 commit comments