Skip to content

Commit 30560b1

Browse files
committed
fix(release): check remote tags using git ls-remote to prevent already exists error
1 parent 95c7774 commit 30560b1

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

.github/workflows/create_additional_release_tag.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,15 @@ jobs:
2020
run: |
2121
git config --local user.email "action@github.com"
2222
git config --local user.name "GitHub Action"
23-
- name: Fetch all tags
24-
run: git fetch --tags
2523
- name: Create additional tags
2624
shell: bash
2725
run: |
2826
ARTIFACT_IDS=('google-cloud-shared-dependencies' 'api-common' 'gax' 'google-cloud-bigtable')
2927
for ARTIFACT_ID in "${ARTIFACT_IDS[@]}"; do
3028
VERSION=$(grep "^${ARTIFACT_ID}:" versions.txt | cut -d':' -f2 | tr -d '[:space:]')
3129
TAG_NAME="${ARTIFACT_ID}/v$VERSION"
32-
if git show-ref --tags | grep -q "refs/tags/$TAG_NAME"; then
33-
echo "Tag $TAG_NAME already exists. Skipping."
30+
if git ls-remote --tags origin | grep -q "refs/tags/$TAG_NAME"; then
31+
echo "Tag $TAG_NAME already exists on remote. Skipping."
3432
continue
3533
fi
3634
git tag $TAG_NAME

0 commit comments

Comments
 (0)