alpine-ai 0.3.0

A lightweight, low-bulk interface for all major LLM providers
Documentation
name: Release

on:
  # Auto-prerelease on merge to default branch
  push:
    branches: [master, main]

  # Manual promotion to full release
  workflow_dispatch:
    inputs:
      tag:
        description: "Tag to promote (e.g. v0.1.0)"
        required: true
        type: string

permissions:
  contents: write

jobs:
  prerelease:
    name: Create Prerelease
    if: github.event_name == 'push'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2

      - name: Install cargo-llvm-cov
        uses: taiki-e/install-action@cargo-llvm-cov

      - name: Get version from Cargo.toml
        id: version
        run: |
          VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
          echo "version=$VERSION" >> "$GITHUB_OUTPUT"
          echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"

      - name: Check if tag exists
        id: check
        run: |
          if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
            echo "exists=true" >> "$GITHUB_OUTPUT"
          else
            echo "exists=false" >> "$GITHUB_OUTPUT"
          fi

      - name: Generate coverage report
        if: steps.check.outputs.exists == 'false'
        run: |
          cargo llvm-cov --features all --lcov --output-path lcov.info
          cargo llvm-cov --features all --no-run 2>&1 | tee coverage-summary.txt

      - name: Create prerelease with coverage
        if: steps.check.outputs.exists == 'false'
        run: |
          gh release create "${{ steps.version.outputs.tag }}" \
            lcov.info \
            coverage-summary.txt \
            --title "${{ steps.version.outputs.tag }} (prerelease)" \
            --generate-notes \
            --prerelease
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  promote:
    name: Promote to Release
    if: github.event_name == 'workflow_dispatch'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Promote prerelease to release
        run: |
          gh release edit "${{ inputs.tag }}" \
            --prerelease=false \
            --title "${{ inputs.tag }}"
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}