From d70da30b8c76d7734bd8de1ec6f80a481addb3b9 Mon Sep 17 00:00:00 2001 From: LTLA Date: Thu, 13 Jun 2024 13:35:08 -0700 Subject: [PATCH] Added action to create new tags on bump. --- .github/workflows/create-tag.yaml | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/create-tag.yaml diff --git a/.github/workflows/create-tag.yaml b/.github/workflows/create-tag.yaml new file mode 100644 index 0000000..b30585d --- /dev/null +++ b/.github/workflows/create-tag.yaml @@ -0,0 +1,33 @@ +on: + workflow_run: + workflows: [Run unit tests] + types: [completed] + branches: [master] + +name: Tag project version + +jobs: + tag: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - uses: actions/checkout@v4 + + - name: Get current version + id: current + run: | + current=$(cat CMakeLists.txt | grep ' *VERSION' | sed 's/.*VERSION //g') + echo "Current version is ${current}" + echo "version=v${current}" >> $GITHUB_OUTPUT + + - name: Get latest version + id: latest + uses: actions-ecosystem/action-get-latest-tag@v1 + with: + semver_only: true + + - name: Tag version if new + if: ${{ steps.current.outputs.version != steps.latest.outputs.tag }} + uses: actions-ecosystem/action-push-tag@v1 + with: + tag: ${{ steps.current.outputs.version }}