Skip to content

Commit dcefa89

Browse files
committed
ci: fix GitHub release workflow to cleanly publish non-draft releases and update latest tag
1 parent e190201 commit dcefa89

1 file changed

Lines changed: 12 additions & 18 deletions

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -134,40 +134,34 @@ jobs:
134134

135135
release:
136136
needs: [build-native, build-wasm]
137-
if: github.event_name == 'push'
137+
if: startsWith(github.ref, 'refs/tags/v')
138138
runs-on: ubuntu-latest
139139
steps:
140140
- uses: actions/checkout@v6
141141

142-
- name: Update latest tag
143-
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
144-
run: |
145-
git config user.name "github-actions"
146-
git config user.email "github-actions@github.com"
147-
git tag -f latest
148-
git push origin -f latest
149-
150142
- name: Download Artifacts
151143
uses: actions/download-artifact@v4
152144
with:
153145
path: artifacts
154146
merge-multiple: true
155147

156-
- name: Release Artifacts
148+
- name: Release Version
157149
env:
158150
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
159151
run: |
160-
TAG_NAME="${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}"
161-
IS_PRERELEASE="${{ !startsWith(github.ref, 'refs/tags/') }}"
152+
TAG_NAME="${{ github.ref_name }}"
162153
163-
# Create release if it doesn't exist
154+
# Create version release if it doesn't exist, marked as latest
164155
if ! gh release view "$TAG_NAME" >/dev/null 2>&1; then
165-
if [ "$IS_PRERELEASE" = "true" ]; then
166-
gh release create "$TAG_NAME" --title "$TAG_NAME" --prerelease
167-
else
168-
gh release create "$TAG_NAME" --title "$TAG_NAME"
169-
fi
156+
gh release create "$TAG_NAME" --title "$TAG_NAME" --generate-notes --latest
170157
fi
171158
172159
# Upload files with clobber (overwrite)
173160
gh release upload "$TAG_NAME" artifacts/* --clobber
161+
162+
# Force update 'latest' tag to the current commit and push
163+
git config user.name "github-actions"
164+
git config user.email "github-actions@github.com"
165+
git tag -f latest
166+
git push -f origin latest
167+

0 commit comments

Comments
 (0)