Skip to content

Merge pull request #5 from mobilecoinofficial/capture-tag-from-commit #5

Merge pull request #5 from mobilecoinofficial/capture-tag-from-commit

Merge pull request #5 from mobilecoinofficial/capture-tag-from-commit #5

Workflow file for this run

# 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-22.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: |
regex=".*\[tag/(.*)\].*"
if [[ "${MESSAGE}" =~ $regex ]]
then
tag=${BASH_REMATCH[1]}
echo -n "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