Create Git Tag #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 # serve per i tag | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - 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 esiste già" | |
| exit 1 | |
| fi | |
| - name: Create and push the tag | |
| run: | | |
| TAG="${{ inputs.tag_name }}" | |
| git tag "$TAG" | |
| git push origin "$TAG" |