Skip to content
name: Create additional tags for each release
on:
release:
types: [published]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Fetch all tags
run: git fetch --tags
- name: Create additional tags
shell: bash
run: |
ARTIFACT_IDS=('google-cloud-shared-dependencies' 'api-common' 'gax')
for ARTIFACT_ID in "${ARTIFACT_IDS[@]}"; do
VERSION=$(grep "^${ARTIFACT_ID}:" versions.txt | cut -d':' -f2 | tr -d '[:space:]')
TAG_NAME="${ARTIFACT_ID}/v$VERSION"
if git show-ref --tags | grep -q "refs/tags/$TAG_NAME"; then
echo "Tag $TAG_NAME already exists. Skipping."
continue
fi
git tag $TAG_NAME
git push origin $TAG_NAME
done
# Generate a tag for unmanaged dependencies check.
# Use fixed tag so that checks in handwritten libraries do not need to
# update the version.
CHECK_LATEST_TAG="unmanaged-dependencies-check-latest"
git tag ${CHECK_LATEST_TAG}
# delete the tag in remote repo and push again.
git push --delete origin ${CHECK_LATEST_TAG}
git push origin ${CHECK_LATEST_TAG}