siggy 1.8.0

Terminal-based Signal messenger client with vim keybindings
Documentation
name: Release

on:
  push:
    tags: ["v*"]

permissions:
  contents: write

jobs:
  check:
    name: Lint & Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - uses: dtolnay/rust-toolchain@stable

      - uses: Swatinem/rust-cache@v2

      - name: Clippy
        run: cargo clippy --tests -- -D warnings

      - name: Test
        run: cargo test

  build:
    name: Build (${{ matrix.target }})
    needs: check
    runs-on: ${{ matrix.runner }}
    strategy:
      matrix:
        include:
          - target: x86_64-unknown-linux-gnu
            runner: ubuntu-latest
            archive: tar.gz
          - target: x86_64-apple-darwin
            runner: macos-latest
            archive: tar.gz
          - target: aarch64-apple-darwin
            runner: macos-latest
            archive: tar.gz
          - target: x86_64-pc-windows-msvc
            runner: windows-latest
            archive: zip
    steps:
      - uses: actions/checkout@v6

      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Ensure cross-compile target is installed
        # dtolnay/rust-toolchain ignores its `targets:` input when a
        # rust-toolchain.toml is present; install explicitly as a fallback.
        run: rustup target add ${{ matrix.target }}

      - uses: Swatinem/rust-cache@v2
        with:
          key: ${{ matrix.target }}

      - name: Build
        run: cargo build --release --target ${{ matrix.target }}

      - name: Package (Unix)
        if: matrix.archive == 'tar.gz'
        run: |
          cd target/${{ matrix.target }}/release
          tar czf ../../../siggy-${{ github.ref_name }}-${{ matrix.target }}.tar.gz siggy
          cd ../../..

      - name: Package (Windows)
        if: matrix.archive == 'zip'
        shell: pwsh
        run: |
          Compress-Archive -Path "target/${{ matrix.target }}/release/siggy.exe" -DestinationPath "siggy-${{ github.ref_name }}-${{ matrix.target }}.zip"

      - name: Upload artifact
        uses: actions/upload-artifact@v7
        with:
          name: siggy-${{ matrix.target }}
          path: siggy-${{ github.ref_name }}-${{ matrix.target }}.*

  release:
    name: Create Release
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/download-artifact@v8
        with:
          merge-multiple: true

      - name: Create GitHub Release
        uses: softprops/action-gh-release@v3
        with:
          generate_release_notes: true
          files: siggy-*

  update-homebrew:
    name: Update Homebrew Tap
    needs: release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - uses: ./.github/actions/update-homebrew
        with:
          tag: ${{ github.ref_name }}
          tap-token: ${{ secrets.TAP_TOKEN }}