1+ name : Create Release
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+ workflow_dispatch :
8+ inputs :
9+ version :
10+ description : ' The tag to build (e.g., v0.1.0). A changelog file for this tag MUST exist.'
11+ required : true
12+ type : string
13+
14+ permissions :
15+ contents : write
16+
17+ jobs :
18+ build_and_pack :
19+ name : Build & Pack on ${{ matrix.platform }}
20+ runs-on : ${{ matrix.os }}
21+
22+ strategy :
23+ fail-fast : false
24+ matrix :
25+ include :
26+ - os : windows-latest
27+ platform : win-x64
28+ rid : win-x64
29+ tfm : net8.0-windows
30+
31+ - os : ubuntu-latest
32+ platform : linux-x64
33+ rid : linux-x64
34+ tfm : net8.0
35+
36+ - os : ubuntu-latest
37+ platform : linux-arm64
38+ rid : linux-arm64
39+ tfm : net8.0
40+
41+ - os : macos-latest
42+ platform : osx-x64
43+ rid : osx-x64
44+ tfm : net8.0-macos
45+
46+ - os : macos-latest
47+ platform : osx-arm64
48+ rid : osx-arm64
49+ tfm : net8.0-macos
50+
51+ steps :
52+ - name : Checkout repository
53+ uses : actions/checkout@v4
54+
55+ - name : Setup .NET 8
56+ uses : actions/setup-dotnet@v4
57+ with :
58+ dotnet-version : ' 8.0.x'
59+
60+ - name : Install Velopack CLI
61+ run : dotnet tool install vpk -g
62+
63+ - name : Get App Version from .csproj
64+ id : get_version
65+ run : |
66+ $version = ([xml](Get-Content -Path ProseFlow.UI/ProseFlow.UI.csproj)).Project.PropertyGroup.Version
67+ echo "APP_VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
68+ shell : pwsh
69+
70+ - name : Set up QEMU for ARM64 cross-compilation
71+ if : matrix.platform == 'linux-arm64'
72+ uses : docker/setup-qemu-action@v3
73+ with :
74+ platforms : linux/arm64
75+
76+ - name : Restore .NET Workloads
77+ run : dotnet workload restore
78+
79+ - name : Publish application
80+ run : |
81+ PUBLISH_ARGS=""
82+ if [[ ! "${{ matrix.platform }}" =~ ^osx-.* ]]; then
83+ PUBLISH_ARGS="-p:PublishSingleFile=true"
84+ fi
85+ if [[ "${{ matrix.platform }}" =~ ^osx-.* ]]; then
86+ PUBLISH_ARGS="$PUBLISH_ARGS -p:CreatePackage=false"
87+ fi
88+
89+ dotnet publish ProseFlow.UI \
90+ -c Release \
91+ -r ${{ matrix.rid }} \
92+ --self-contained \
93+ -f ${{ matrix.tfm }} \
94+ -p:UseAppHost=true \
95+ -o "publish" \
96+ $PUBLISH_ARGS
97+ shell : bash
98+
99+ - name : Pack with Velopack
100+ run : |
101+ $originalNotesFile = "Changelogs/${{ github.event_name == 'push' && github.ref_name || inputs.version }}.md"
102+ $sanitizedNotesFile = "sanitized-notes.md"
103+ $originalContent = Get-Content -Path $originalNotesFile -Raw
104+ $sanitizedContent = [System.Security.SecurityElement]::Escape($originalContent)
105+ Set-Content -Path $sanitizedNotesFile -Value $sanitizedContent -Encoding utf8
106+
107+ if ("${{ matrix.platform }}".StartsWith("osx-")) {
108+ $packDir = "ProseFlow.UI/bin/Release/${{ matrix.tfm }}/${{ matrix.rid }}"
109+ vpk pack `
110+ -u ProseFlow `
111+ -v ${{ env.APP_VERSION }} `
112+ -p $packDir `
113+ -o "Velo-Output" `
114+ -r ${{ matrix.rid }} `
115+ --channel ${{ matrix.platform }} `
116+ --releaseNotes $sanitizedNotesFile `
117+ --mainExe ProseFlow.app/Contents/MacOS/ProseFlow
118+ } else {
119+ vpk pack `
120+ -u ProseFlow `
121+ -v ${{ env.APP_VERSION }} `
122+ -p "publish" `
123+ -o "Velo-Output" `
124+ -r ${{ matrix.rid }} `
125+ --channel ${{ matrix.platform }} `
126+ --releaseNotes $sanitizedNotesFile
127+ }
128+ shell : pwsh
129+
130+ - name : Upload Release Artifacts
131+ uses : actions/upload-artifact@v4
132+ with :
133+ name : release-artifacts-${{ matrix.platform }}
134+ path : Velo-Output/*
135+
136+ release :
137+ name : Create GitHub Release
138+ runs-on : ubuntu-latest
139+ needs : build_and_pack
140+
141+ steps :
142+ - name : Checkout repository
143+ uses : actions/checkout@v4
144+
145+ - name : Get App Version from .csproj
146+ id : get_version
147+ run : |
148+ version=$(grep '<Version>' ProseFlow.UI/ProseFlow.UI.csproj | sed -e 's/.*<Version>\(.*\)<\/Version>.*/\1/')
149+ echo "APP_VERSION=$version" >> $GITHUB_ENV
150+ shell : bash
151+
152+ - name : Download all release artifacts
153+ uses : actions/download-artifact@v4
154+ with :
155+ path : release-assets
156+ pattern : release-artifacts-*
157+ merge-multiple : true
158+
159+ - name : List downloaded files
160+ run : ls -R release-assets
161+
162+ - name : Create Release and Upload Assets
163+ uses : softprops/action-gh-release@v2.3.3
164+ with :
165+ tag_name : ${{ github.event_name == 'push' && github.ref_name || inputs.version }}
166+ name : " ProseFlow ${{ github.event_name == 'push' && github.ref_name || inputs.version }}"
167+ body_path : " Changelogs/${{ github.event_name == 'push' && github.ref_name || inputs.version }}.md"
168+ files : release-assets/*
0 commit comments