githubdw 0.1.0

Local SQLite data warehouse for GitHub repositories: sync PRs, reviews, and issues; query, metrics, fulltext search, and MCP server
Documentation
name: Release

on:
  push:
    tags:
      - "v[0-9]+.[0-9]+.[0-9]+*"

permissions:
  contents: write

jobs:
  release:
    name: Release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Extract version from tag
        id: version
        run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"

      - name: Verify tag matches Cargo.toml version
        run: |
          crate_version=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)
          if [ "$crate_version" != "${{ steps.version.outputs.version }}" ]; then
            echo "Tag ${{ steps.version.outputs.version }} != Cargo.toml $crate_version" >&2
            exit 1
          fi

      - name: Extract changelog section
        id: changelog
        run: |
          # Extract the section for this version from CHANGELOG.md
          section=$(awk '/^## \['"${{ steps.version.outputs.version }}"'\]/{found=1; next} /^## \[/{if(found) exit} found{print}' CHANGELOG.md)
          {
            echo "notes<<EOF"
            echo "$section"
            echo "EOF"
          } >> "$GITHUB_OUTPUT"

      - name: Create GitHub Release
        run: |
          gh release create "$GITHUB_REF_NAME" \
            --title "$GITHUB_REF_NAME" \
            --notes "$RELEASE_NOTES"
        env:
          GH_TOKEN: ${{ github.token }}
          RELEASE_NOTES: ${{ steps.changelog.outputs.notes }}

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Publish to crates.io
        run: cargo publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}