@@ -3,6 +3,9 @@ name: Desktop Publish
33on :
44 workflow_dispatch :
55
6+ permissions :
7+ contents : write
8+
69jobs :
710 build-browser :
811 runs-on : ubuntu-latest
@@ -90,13 +93,12 @@ jobs:
9093 Move-Item -Path publish/WebTranslator.Desktop.exe -Destination publish/WebTranslator.exe -Force
9194 }
9295 Get-ChildItem publish -Include *.pdb,*.dbg -File -ErrorAction SilentlyContinue | Remove-Item -Force
93- & "${env:ProgramFiles}\7-Zip\7z.exe" a -t7z -mx=9 WebTranslator-windows_amd64.7z .\publish\*
9496
9597 - name : Upload Windows Build
9698 uses : actions/upload-artifact@v7
9799 with :
98100 name : WebTranslator-windows_amd64
99- path : WebTranslator-windows_amd64.7z
101+ path : publish/ WebTranslator.exe
100102 compression-level : 0
101103
102104 build-ubuntu :
@@ -113,7 +115,7 @@ jobs:
113115 dotnet-version : 9.0.x
114116
115117 - name : Install dependencies (AOT prerequisites)
116- run : sudo apt-get update && sudo apt-get install -y clang zlib1g-dev p7zip-full
118+ run : sudo apt-get update && sudo apt-get install -y clang zlib1g-dev
117119
118120 - name : Publish (Linux, net9.0, AOT, self-contained)
119121 run : >-
@@ -128,20 +130,25 @@ jobs:
128130 - name : Rename and Clean Ubuntu Files
129131 run : |
130132 if [ -f publish/WebTranslator.Desktop ]; then mv publish/WebTranslator.Desktop publish/WebTranslator; fi
133+ chmod +x publish/WebTranslator
131134 rm -f publish/*.pdb publish/*.dbg || true
132- 7z a -t7z -mx=9 WebTranslator-linux_amd64.7z ./publish/*
133135
134136 - name : Upload Ubuntu Build
135137 uses : actions/upload-artifact@v7
136138 with :
137139 name : WebTranslator-linux_amd64
138- path : WebTranslator-linux_amd64.7z
140+ path : publish/ WebTranslator
139141 compression-level : 0
140142
141143 release :
142- needs : [build-windows, build-ubuntu]
144+ needs : [build-browser, build- windows, build-ubuntu]
143145 runs-on : ubuntu-latest
144146 steps :
147+ - name : Checkout
148+ uses : actions/checkout@v6
149+ with :
150+ fetch-depth : 0
151+
145152 - name : Download Windows Build
146153 uses : actions/download-artifact@v8
147154 with :
@@ -153,3 +160,37 @@ jobs:
153160 with :
154161 name : WebTranslator-linux_amd64
155162 path : release/ubuntu
163+
164+ - name : Create release files
165+ run : |
166+ mkdir -p release/assets
167+ cp release/windows/WebTranslator.exe release/assets/WebTranslator-windows_amd64.exe
168+ cp release/ubuntu/WebTranslator release/assets/WebTranslator-linux_amd64
169+ chmod +x release/assets/WebTranslator-linux_amd64
170+
171+ - name : Create release notes
172+ run : |
173+ previous_tag="$(git describe --tags --abbrev=0 --match 'publish-*' 2>/dev/null || true)"
174+ if [ -n "$previous_tag" ]; then
175+ git log --pretty=format:'- %s (%h)' "${previous_tag}..HEAD" > release-notes.md
176+ else
177+ git log --pretty=format:'- %s (%h)' > release-notes.md
178+ fi
179+ if [ ! -s release-notes.md ]; then
180+ echo "- No commits since the previous publish release." > release-notes.md
181+ fi
182+
183+ - name : Publish GitHub Release
184+ env :
185+ GH_TOKEN : ${{ github.token }}
186+ RELEASE_TAG : publish-${{ github.run_number }}.${{ github.run_attempt }}
187+ run : |
188+ gh release create "$RELEASE_TAG" \
189+ release/assets/WebTranslator-windows_amd64.exe \
190+ release/assets/WebTranslator-linux_amd64 \
191+ --repo "$GITHUB_REPOSITORY" \
192+ --target "$GITHUB_SHA" \
193+ --title "$RELEASE_TAG" \
194+ --notes-file release-notes.md \
195+ --prerelease \
196+ --latest=false
0 commit comments