Skip to content

Commit 1d0f57a

Browse files
authored
TA-4578: Skip tag creation if it exists (#289)
1 parent 4de7e7e commit 1d0f57a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/build-or-publish.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,14 @@ jobs:
130130
run: |
131131
version=$(node -p "require('./package.json').version")
132132
tag="v${version}"
133-
echo "version=${version}" >> $GITHUB_OUTPUT
134133
echo "tag=${tag}" >> $GITHUB_OUTPUT
135-
git tag "${tag}"
136-
git push https://x-access-token:${GIT_TOKEN}@github.com/${{ github.repository }} "${tag}"
134+
git fetch origin --tags || true
135+
if ! git rev-parse "${tag}" >/dev/null 2>&1; then
136+
git tag "${tag}"
137+
git push https://x-access-token:${GIT_TOKEN}@github.com/${{ github.repository }} "${tag}"
138+
else
139+
echo "Tag ${tag} already exists, skipping creation"
140+
fi
137141
138142
- name: Generate release notes
139143
uses: softprops/action-gh-release@v2.4.2

0 commit comments

Comments
 (0)