name: Release bundle
on:
  release:
    types: [created]

permissions:
  contents: write

jobs:
  bundle:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: Build .skill bundle
        run: |
          mkdir -p /tmp/bundle/task-observer
          cp SKILL.md /tmp/bundle/task-observer/
          cp -r references scripts /tmp/bundle/task-observer/
          python3 scripts/validate-skill-bundle.py /tmp/bundle/task-observer --pack /tmp/bundle/task-observer.skill
      - name: Attach to release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: gh release upload "${{ github.event.release.tag_name }}" /tmp/bundle/task-observer.skill --clobber --repo "$GITHUB_REPOSITORY"
