name: Publish Release

on:
  push:
    tags:
      - "v*"

permissions:
  contents: write

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - uses: actions/setup-python@v6
        with:
          python-version: "3.11"

      - name: Verify release metadata
        run: |
          python -m py_compile serve.py serve_lite.py scripts/*.py
          python scripts/check_release_consistency.py --tag "${GITHUB_REF_NAME}"
          python scripts/check_sensitive_data.py

      - name: Publish GitHub Release
        uses: softprops/action-gh-release@v2
        with:
          generate_release_notes: true
