File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,11 +3,7 @@ name: Create additional tags for each release
33on :
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
128jobs :
139 build :
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
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
You can’t perform that action at this time.
0 commit comments