Merge pull request #22 from mobilecoinofficial/renovate/ubuntu-24.x #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2024 MobileCoin Inc. | |
name: tag | |
on: | |
push: | |
branches: | |
- main | |
# when the gh publishes a new ghcr.io/actions/actions-runner image renovate should PR and add in a message like `[tag/2.310.0]` | |
# capture this output and tag the repo triggering the other build actions. | |
jobs: | |
tag: | |
runs-on: ubuntu-24.04 | |
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 }} | |
- 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 |