From a008f278136fdc3e22ae40303a8ad45900320d28 Mon Sep 17 00:00:00 2001 From: Christian Tosta Date: Fri, 18 Apr 2025 10:51:42 -0300 Subject: [PATCH] Added auto-tagging workflow --- .github/workflows/auto-tag.yml | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/auto-tag.yml diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml new file mode 100644 index 0000000..ae946dc --- /dev/null +++ b/.github/workflows/auto-tag.yml @@ -0,0 +1,40 @@ +name: auto-tag + +on: + push: + schedule: + - cron: '30 3 * * *' + +jobs: + create-tag: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get -y install cmake g++ gcc + + - name: Set environment + run: | + cmake --fresh -B build -S . + echo "NEW_TAG=v$(cat build/version)" >> $GITHUB_ENV + + - name: Check if package version has corresponding git tag + id: tagged + shell: bash + run: | + git show-ref \ + --tags --verify --quiet -- \ + "refs/tags/${NEW_TAG}" \ + && echo tagged=1 >> $GITHUB_OUTPUT \ + || echo tagged=0 >> $GITHUB_OUTPUT + + - name: Create new tag + if: steps.tagged.outputs.tagged == 0 + run: | + git tag ${NEW_TAG} \ + && git push origin ${NEW_TAG}) \ + || exit 0