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