Skip to content

Commit 033a12e

Browse files
committed
ci: use ncipollo/release-action for dual release patterns
This satisfies two URL patterns: 1. /releases/latest/download/<asset> 2. /releases/download/latest/<asset> Uses ncipollo/release-action to cleanly handle clobbering, making the version tag the official 'Latest' release, and maintaining the floating 'latest' git tag release.
1 parent dcefa89 commit 033a12e

1 file changed

Lines changed: 23 additions & 15 deletions

File tree

.github/workflows/ci.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -145,23 +145,31 @@ jobs:
145145
path: artifacts
146146
merge-multiple: true
147147

148-
- name: Release Version
149-
env:
150-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151-
run: |
152-
TAG_NAME="${{ github.ref_name }}"
153-
154-
# Create version release if it doesn't exist, marked as latest
155-
if ! gh release view "$TAG_NAME" >/dev/null 2>&1; then
156-
gh release create "$TAG_NAME" --title "$TAG_NAME" --generate-notes --latest
157-
fi
158-
159-
# Upload files with clobber (overwrite)
160-
gh release upload "$TAG_NAME" artifacts/* --clobber
148+
- name: Create Versioned Release
149+
uses: ncipollo/release-action@v1
150+
with:
151+
tag: ${{ github.ref_name }}
152+
name: Release ${{ github.ref_name }}
153+
artifacts: "artifacts/*"
154+
generateReleaseNotes: true
155+
makeLatest: true
161156

162-
# Force update 'latest' tag to the current commit and push
157+
- name: Update Floating 'latest' Git Tag
158+
run: |
163159
git config user.name "github-actions"
164160
git config user.email "github-actions@github.com"
161+
git push origin :refs/tags/latest || true
165162
git tag -f latest
166-
git push -f origin latest
163+
git push origin latest
164+
165+
- name: Create or Update 'latest' Release
166+
uses: ncipollo/release-action@v1
167+
with:
168+
tag: "latest"
169+
name: "Latest Release"
170+
body: "Autogenerated release for the latest tag (${{ github.ref_name }})"
171+
artifacts: "artifacts/*"
172+
allowUpdates: true
173+
replacesArtifacts: true
174+
makeLatest: false
167175

0 commit comments

Comments
 (0)