Skip to content

Commit a988fe7

Browse files
authored
fix: update tag workflow (#1699)
* fix: update tag workflow * update indentation and remove ref
1 parent 4ec1b2d commit a988fe7

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

.github/workflows/create_additional_release_tag.yaml

+10-11
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ name: Create additional tags for each release
33
on:
44
release:
55
types: [published]
6-
workflow_dispatch: # If manually triggered, clarify which release to create the additional tags for
7-
inputs:
8-
releaseTag:
9-
description: 'Release Tag'
10-
required: true
6+
workflow_dispatch:
117

128
jobs:
139
build:
@@ -17,7 +13,6 @@ jobs:
1713
- name: Checkout code
1814
uses: actions/checkout@v3
1915
with:
20-
ref: ${{ github.event.inputs.releaseTag }}
2116
token: ${{ secrets.GITHUB_TOKEN }}
2217

2318
- name: Set up Git
@@ -28,9 +23,13 @@ jobs:
2823
- name: Create additional tags
2924
run: |
3025
ARTIFACT_IDS=('google-cloud-shared-dependencies' 'api-common' 'gax')
31-
for ARTIFACT_ID in "${ARTIFACT_IDS[@]}"
32-
do
33-
VERSION=$(grep "${ARTIFACT_ID}" versions.txt | cut -d':' -f2)
34-
git tag ${ARTIFACT_ID}/$VERSION ${{ github.event.inputs.releaseTag }}
35-
git push origin ${ARTIFACT_ID}/$VERSION
26+
for ARTIFACT_ID in "${ARTIFACT_IDS[@]}"; do
27+
VERSION=$(grep "^${ARTIFACT_ID}:" versions.txt | cut -d':' -f2 | tr -d '[:space:]')
28+
TAG_NAME="${ARTIFACT_ID}/v$VERSION"
29+
if git show-ref --tags | grep -q "refs/tags/$TAG_NAME"; then
30+
echo "Tag $TAG_NAME already exists. Skipping."
31+
continue
32+
fi
33+
git tag $TAG_NAME
34+
git push origin $TAG_NAME
3635
done

0 commit comments

Comments
 (0)