name: Create Tag

on:
  workflow_dispatch:
    inputs:
      tag:
        description: 'Tag name (e.g. v1.33.2)'
        required: true
      ref:
        description: 'Branch, commit SHA, or existing tag to tag from'
        required: false
        default: 'main'

jobs:
  tag:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ inputs.ref }}

      - name: Create and push tag
        env:
          TAG: ${{ inputs.tag }}
        run: |
          git tag -- "$TAG"
          git push origin -- "$TAG"
