fix: crash when tag already exists #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Deno setup | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: vx.x.x | |
- name: Test | |
run: deno task test | |
- name: Check format, linting, types | |
run: deno task check | |
- name: Publish to JSR | |
run: deno publish | |
- name: Publish to Deno.land/x | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git fetch --tags | |
VERSION=$(jq -r '.version' deno.json) | |
if git rev-parse "$VERSION" >/dev/null 2>&1; then | |
echo "Tag $VERSION already exists, doing nothing." | |
else | |
# If the tag does not exist, create and push it | |
git tag "$VERSION" | |
git push origin "$VERSION" | |
fi |