From e03c1ce6923c195eceb40a0755f77d1d6a1fd2f3 Mon Sep 17 00:00:00 2001 From: Nicola Demo Date: Fri, 12 Dec 2025 15:56:01 +0100 Subject: [PATCH] Add workflow to create Git tags on demand This workflow allows users to create a Git tag via a manual trigger, checking for existing tags before creating a new one. --- .github/workflows/create-tag.yml | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/create-tag.yml diff --git a/.github/workflows/create-tag.yml b/.github/workflows/create-tag.yml new file mode 100644 index 000000000..fbdb16185 --- /dev/null +++ b/.github/workflows/create-tag.yml @@ -0,0 +1,44 @@ +name: Create Git Tag + +on: + workflow_dispatch: + inputs: + tag_name: + description: "Tag name (eg. v1.3.0)" + required: true + type: string + +permissions: + contents: write + +jobs: + create_tag: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Configure git with PAT + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git remote set-url origin "https://x-access-token:${{ secrets.PAT_PINA_PUSH }}@github.com/${{ github.repository }}.git" + + - name: Check if the tag is already existing + run: | + TAG="${{ inputs.tag_name }}" + git fetch --tags + if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then + echo "❌ Tag $TAG already exists" + exit 1 + fi + + - name: Create and push the tag + run: | + TAG="${{ inputs.tag_name }}" + git tag "$TAG" + git push origin "$TAG"