ferrflow 3.2.0

Universal semantic versioning for monorepos and classic repos
Documentation
name: Release (manual rebuild)

on:
  workflow_dispatch:
    inputs:
      tag:
        description: 'Tag to build (e.g. v0.6.0)'
        required: true

permissions:
  contents: read

jobs:
  build:
    name: Build ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - target: x86_64-unknown-linux-musl
            os: ubuntu-latest
            binary: ferrflow
            archive: ferrflow-linux-x64.tar.gz
          - target: aarch64-unknown-linux-musl
            os: ubuntu-latest
            binary: ferrflow
            archive: ferrflow-linux-arm64.tar.gz
          - target: x86_64-apple-darwin
            os: macos-latest
            binary: ferrflow
            archive: ferrflow-darwin-x64.tar.gz
          - target: aarch64-apple-darwin
            os: macos-latest
            binary: ferrflow
            archive: ferrflow-darwin-arm64.tar.gz
          - target: x86_64-pc-windows-msvc
            os: windows-latest
            binary: ferrflow.exe
            archive: ferrflow-windows-x64.zip
    steps:
      - uses: actions/checkout@v6
        with:
          ref: ${{ inputs.tag }}
      - uses: dtolnay/rust-toolchain@nightly
        with:
          targets: ${{ matrix.target }}
      - uses: Swatinem/rust-cache@v2
      - name: Install cross
        if: matrix.os == 'ubuntu-latest'
        run: |
          curl -fsSL https://github.com/cross-rs/cross/releases/latest/download/cross-x86_64-unknown-linux-musl.tar.gz \
            | tar xz -C "$HOME/.cargo/bin"
      - name: Build (Linux)
        if: matrix.os == 'ubuntu-latest'
        run: cross build --release --target ${{ matrix.target }}
        env:
          FERRFLOW_HMAC_SECRET: ${{ secrets.FERRFLOW_HMAC_SECRET }}
      - name: Build (macOS / Windows)
        if: matrix.os != 'ubuntu-latest'
        run: cargo build --release --target ${{ matrix.target }}
        env:
          FERRFLOW_HMAC_SECRET: ${{ secrets.FERRFLOW_HMAC_SECRET }}
      - name: Package (Unix)
        if: matrix.os != 'windows-latest'
        run: |
          tar -czf ${{ matrix.archive }} \
            -C target/${{ matrix.target }}/release ${{ matrix.binary }}
      - name: Package (Windows)
        if: matrix.os == 'windows-latest'
        run: |
          Compress-Archive `
            -Path target/${{ matrix.target }}/release/${{ matrix.binary }} `
            -DestinationPath ${{ matrix.archive }}
      - uses: actions/upload-artifact@v7
        with:
          name: ${{ matrix.archive }}
          path: ${{ matrix.archive }}

  release:
    name: Upload Assets
    needs: build
    runs-on: ubuntu-latest
    permissions:
      contents: write
      id-token: write
      attestations: write
    steps:
      - uses: actions/checkout@v6
        with:
          ref: ${{ inputs.tag }}
      - uses: actions/download-artifact@v8
        with:
          path: artifacts/
          merge-multiple: true
      - name: Generate shell completions
        run: |
          tar -xzf artifacts/ferrflow-linux-x64.tar.gz -C /tmp
          chmod +x /tmp/ferrflow
          mkdir -p completions
          /tmp/ferrflow completions bash > completions/ferrflow.bash
          /tmp/ferrflow completions zsh  > completions/_ferrflow
          /tmp/ferrflow completions fish > completions/ferrflow.fish
          tar -czf artifacts/ferrflow-completions.tar.gz -C completions .
      - name: Attest build provenance
        uses: actions/attest-build-provenance@v4
        with:
          subject-path: artifacts/*
      - uses: softprops/action-gh-release@v3
        with:
          tag_name: ${{ inputs.tag }}
          files: artifacts/*
          generate_release_notes: false