From 44e71e32fa3401f60a4f942e7edbbc9092223658 Mon Sep 17 00:00:00 2001 From: Iresh Dissanayaka Date: Sat, 21 Sep 2024 18:57:32 +0000 Subject: [PATCH] update tag workflow to use official github actions --- .github/workflows/tag.yaml | 48 +++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml index 4d34bb9..983f23f 100644 --- a/.github/workflows/tag.yaml +++ b/.github/workflows/tag.yaml @@ -11,32 +11,26 @@ on: jobs: tag: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - # We need to use an external PAT here because GHA will not run downstream events if we use the built in token. - - name: Checkout - uses: mobilecoinofficial/gh-actions/checkout@v0 - with: - token: ${{ secrets.ACTIONS_TOKEN }} + - uses: actions/checkout@v4 + - env: + MESSAGE: ${{ github.event.head_commit.message }} + shell: bash + run: | + # look for sting like "[tag/v2.312.0]" in commit message. + regex=".*\[tag/(.*)\].*" - - name: Get new tag from commit and push - shell: bash - env: - MESSAGE: ${{ github.event.head_commit.message }} - run: | - # look for sting like "[tag/v2.312.0]" in commit message. - regex=".*\[tag/(.*)\].*" - - if [[ "${MESSAGE}" =~ $regex ]] - then - tag="${BASH_REMATCH[1]}" - # remove v prefix if it exists. - tag="${tag/#v/}" - echo "Found tag: ${tag}" - git tag --force "${tag}" - git push --tags --force - else - echo "Could not find tag in commit message" - echo "${MESSAGE}" - exit 0 - fi + if [[ "${MESSAGE}" =~ $regex ]] + then + tag="${BASH_REMATCH[1]}" + # remove v prefix if it exists. + tag="${tag/#v/}" + echo "Found tag: ${tag}" + git tag --force "${tag}" + git push --tags --force + else + echo "Could not find tag in commit message" + echo "${MESSAGE}" + exit 0 + fi \ No newline at end of file