Skip to content

Commit 3241ac0

Browse files
authored
Merge pull request #31 from wusyong/ct
Update release tag name and check if exist before release
2 parents 495e7e5 + b154d0a commit 3241ac0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

.github/workflows/rust.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ jobs:
190190
git diff --staged --no-ext-diff --quiet --exit-code
191191
192192
publish-release:
193-
name: Publish release
193+
name: Check version and publish release
194194
runs-on: ubuntu-latest
195195
needs:
196196
["linux", "mac", "windows"]
@@ -200,14 +200,19 @@ jobs:
200200
- uses: actions/download-artifact@v4
201201
with:
202202
merge-multiple: true
203-
- id: release
203+
- id: check-tag
204204
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
205205
run: |
206-
RELEASE_TAG=$(date "+%F-%H-%M")
207-
gh release create ${RELEASE_TAG} ./*.tar.gz
206+
RELEASE_TAG=mozjs-sys-v$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "mozjs_sys") | .version')
207+
if git show-ref --tags --verify --quiet "refs/tags/${RELEASE_TAG}"; then
208+
RELEASE_TAG=''
209+
fi
208210
echo "RELEASE_TAG=${RELEASE_TAG}" >> ${GITHUB_OUTPUT}
211+
- name: Publish release
212+
if: ${{ steps.check-tag.outputs.RELEASE_TAG != '' }}
213+
run: gh release create ${{ steps.check-tag.outputs.RELEASE_TAG }} ./*.tar.gz
209214
outputs:
210-
release-tag: ${{ steps.release.outputs.RELEASE_TAG }}
215+
release-tag: ${{ steps.check-tag.outputs.RELEASE_TAG }}
211216

212217
verify-release:
213218
name: Verify release

0 commit comments

Comments
 (0)