Skip to content

Commit 3f77c4d

Browse files
committed
Add tag existence check before creating a new tag in release workflow
1 parent 32f39e7 commit 3f77c4d

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,18 @@ jobs:
2323
VERSION=$(grep -oP '"version":\s*"\K[^"]+' src/manifest_firefox.json)
2424
echo "VERSION=v$VERSION" >> $GITHUB_OUTPUT
2525
26-
- name: Create and push tag
26+
- name: Check if tag exists
27+
id: check_tag
2728
if: github.ref == 'refs/heads/master'
29+
run: |
30+
if git rev-parse ${{ steps.manifest_version.outputs.VERSION }} >/dev/null 2>&1; then
31+
echo "TAG_EXISTS=true" >> $GITHUB_OUTPUT
32+
else
33+
echo "TAG_EXISTS=false" >> $GITHUB_OUTPUT
34+
fi
35+
36+
- name: Create and push tag
37+
if: github.ref == 'refs/heads/master' && steps.check_tag.outputs.TAG_EXISTS == 'false'
2838
run: |
2939
git config user.name "github-actions[bot]"
3040
git config user.email "github-actions[bot]@users.noreply.github.com"

0 commit comments

Comments
 (0)