@@ -12,6 +12,9 @@ concurrency:
1212 group : release-${{ github.ref }}
1313 cancel-in-progress : false
1414
15+ env :
16+ RELEASE_VERSION : ${{ github.ref_name }}
17+
1518jobs :
1619 build :
1720 name : Build ${{ matrix.target }}
@@ -145,14 +148,14 @@ jobs:
145148 run : |
146149 mkdir -p dist/package
147150 cp "target/${{ matrix.target }}/release/bitloops-inference" dist/package/bitloops-inference
148- tar -C dist/package -czf "dist/bitloops-inference-${{ matrix.target }}.tar.gz" bitloops-inference
151+ tar -C dist/package -czf "dist/bitloops-inference-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz" bitloops-inference
149152
150153 - name : Package (macOS)
151154 if : runner.os == 'macOS'
152155 run : |
153156 mkdir -p dist/package
154157 cp "target/${{ matrix.target }}/release/bitloops-inference" dist/package/bitloops-inference
155- ditto -c -k --keepParent dist/package "dist/bitloops-inference-${{ matrix.target }}.zip"
158+ ditto -c -k --keepParent dist/package "dist/bitloops-inference-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.zip"
156159
157160 - name : Restore App Store Connect key
158161 if : runner.os == 'macOS'
@@ -167,7 +170,7 @@ jobs:
167170 APPSTORE_CONNECT_KEY_ID : ${{ vars.APPSTORE_CONNECT_KEY_ID }}
168171 APPSTORE_CONNECT_ISSUER_ID : ${{ vars.APPSTORE_CONNECT_ISSUER_ID }}
169172 run : |
170- xcrun notarytool submit "dist/bitloops-inference-${{ matrix.target }}.zip" \
173+ xcrun notarytool submit "dist/bitloops-inference-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.zip" \
171174 --key AuthKey.p8 \
172175 --key-id "$APPSTORE_CONNECT_KEY_ID" \
173176 --issuer "$APPSTORE_CONNECT_ISSUER_ID" \
@@ -179,13 +182,13 @@ jobs:
179182 run : |
180183 New-Item -ItemType Directory -Path dist/package -Force | Out-Null
181184 Copy-Item "target/${{ matrix.target }}/release/bitloops-inference.exe" "dist/package/bitloops-inference.exe" -Force
182- Compress-Archive -Path dist/package/* -DestinationPath "dist/bitloops-inference-${{ matrix.target }}.zip"
185+ Compress-Archive -Path dist/package/* -DestinationPath "dist/bitloops-inference-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.zip"
183186
184187 - name : Upload build artefact
185- uses : actions/upload-artifact@v4
188+ uses : actions/upload-artifact@v6
186189 with :
187190 name : release-${{ matrix.target }}
188- path : dist/bitloops-inference-${{ matrix.target }}.*
191+ path : dist/bitloops-inference-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.*
189192
190193 publish :
191194 name : Publish release
@@ -197,22 +200,42 @@ jobs:
197200 SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
198201 steps :
199202 - name : Download packaged artefacts
200- uses : actions/download-artifact@v4
203+ uses : actions/download-artifact@v7
201204 with :
202205 path : dist
203206 merge-multiple : true
204207
205208 - name : Generate checksums
206209 run : |
207210 cd dist
208- sha256sum bitloops-inference-* > checksums-sha256.txt
211+ sha256sum bitloops-inference-${{ env.RELEASE_VERSION }}-* > checksums-sha256.txt
212+
213+ - name : Remove stale release assets
214+ env :
215+ GH_TOKEN : ${{ github.token }}
216+ run : |
217+ if ! gh release view "${{ github.ref_name }}" >/dev/null 2>&1; then
218+ exit 0
219+ fi
220+
221+ gh release view "${{ github.ref_name }}" --json assets --jq '.assets[].name' |
222+ while IFS= read -r asset; do
223+ case "$asset" in
224+ bitloops-inference-${{ env.RELEASE_VERSION }}-*)
225+ ;;
226+ bitloops-inference-*)
227+ gh release delete-asset "${{ github.ref_name }}" "$asset" --yes
228+ ;;
229+ esac
230+ done
209231
210232 - name : Publish to GitHub Releases
211233 uses : softprops/action-gh-release@v2
212234 with :
213235 generate_release_notes : true
236+ overwrite_files : true
214237 files : |
215- dist/bitloops-inference-*
238+ dist/bitloops-inference-${{ env.RELEASE_VERSION }}- *
216239 dist/checksums-sha256.txt
217240
218241 - name : Send Slack notification
0 commit comments