From c0ea24588de744a46600fcf6f0f3c6414549e12d Mon Sep 17 00:00:00 2001 From: Alice <65933803+alicejli@users.noreply.github.com> Date: Mon, 22 May 2023 16:46:24 -0400 Subject: [PATCH] feat: Create additional tag on release for google-cloud-shared-dependencies (#1692) * test workflow to add new tag to release * test with token for forked repo * forked repo * add distribution * update pom path * edit permissions * update workflow to use versions.txt file instead of pom.xml * test workflow on forked repo only * remove release tag needed for fork only * parsing versions.txt means we don't need maven, so removing java setup * fix workflow * add back in manual input * update name of workflow * update to create multiple tags * update name of workflow * add newline * fix typo --- .../create_additional_release_tag.yaml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/create_additional_release_tag.yaml diff --git a/.github/workflows/create_additional_release_tag.yaml b/.github/workflows/create_additional_release_tag.yaml new file mode 100644 index 0000000000..4270461be5 --- /dev/null +++ b/.github/workflows/create_additional_release_tag.yaml @@ -0,0 +1,36 @@ +name: Create additional tags for each release + +on: + release: + types: [published] + workflow_dispatch: # If manually triggered, clarify which release to create the additional tags for + inputs: + releaseTag: + description: 'Release Tag' + required: true + +jobs: + build: + runs-on: ubuntu-latest + permissions: write-all + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + ref: ${{ github.event.inputs.releaseTag }} + 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: Create additional tags + 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) + git tag ${ARTIFACT_ID}/$VERSION ${{ github.event.inputs.releaseTag }} + git push origin ${ARTIFACT_ID}/$VERSION + done