name: Create Release

on:
  push:
    tags:
      - "v*"

permissions:
  contents: write

jobs:
  create:
    runs-on: ubuntu-latest
    steps:
      - name: Create Draft Release
        env:
          GH_TOKEN: ${{ github.token }}
        run: |
          TAG="${GITHUB_REF#refs/tags/}"
          VERSION="${TAG#v}"
          gh release create "$TAG" \
            --repo "$GITHUB_REPOSITORY" \
            --title "Yao v${VERSION}" \
            --generate-notes \
            --draft
