iris-reader 1.0.0

A terminal-native viewer for documents, structured data, images, PDFs, databases, and stdin.
Documentation
name: Release

on:
  push:
    tags:
      - "v*.*.*"

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  verify:
    name: Verify release
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v7

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy

      - name: Cache Cargo
        uses: Swatinem/rust-cache@v2

      - name: Verify tag matches Cargo.toml
        shell: bash
        run: |
          TAG_VERSION="${GITHUB_REF_NAME#v}"
          CARGO_VERSION="$(
            cargo metadata --no-deps --format-version 1 |
              jq -r '.packages[] | select(.name == "iris-reader") | .version'
          )"

          if [[ "$TAG_VERSION" != "$CARGO_VERSION" ]]; then
            echo "Tag version:   $TAG_VERSION"
            echo "Cargo version: $CARGO_VERSION"
            echo "The Git tag must match Cargo.toml."
            exit 1
          fi

      - name: Check formatting
        run: cargo fmt --all -- --check

      - name: Run Clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

      - name: Run tests
        run: cargo test --all-features --locked

  build:
    name: Build ${{ matrix.name }}
    needs: verify
    runs-on: ${{ matrix.runner }}

    strategy:
      fail-fast: false
      matrix:
        include:
          - name: Linux x86_64
            runner: ubuntu-26.04
            target: x86_64-unknown-linux-gnu
            platform: linux-x86_64

          - name: Linux ARM64
            runner: ubuntu-26.04-arm
            target: aarch64-unknown-linux-gnu
            platform: linux-aarch64

          - name: macOS Intel
            runner: macos-26-intel
            target: x86_64-apple-darwin
            platform: macos-x86_64

          - name: macOS Apple Silicon
            runner: macos-26
            target: aarch64-apple-darwin
            platform: macos-aarch64

          - name: Windows x86_64
            runner: windows-2025
            target: x86_64-pc-windows-msvc
            platform: windows-x86_64

    steps:
      - name: Checkout
        uses: actions/checkout@v7

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

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

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

      - name: Package Unix binary
        if: runner.os != 'Windows'
        shell: bash
        run: |
          mkdir -p dist
          ARCHIVE="iris-${GITHUB_REF_NAME}-${{ matrix.platform }}.tar.gz"
          tar -C "target/${{ matrix.target }}/release" -czf "dist/$ARCHIVE" iris
          cd dist
          shasum -a 256 "$ARCHIVE" > "$ARCHIVE.sha256"

      - name: Package Windows binary
        if: runner.os == 'Windows'
        shell: pwsh
        run: |
          New-Item -ItemType Directory -Force -Path dist | Out-Null
          $archive = "iris-$env:GITHUB_REF_NAME-${{ matrix.platform }}.zip"
          $binary = "target\${{ matrix.target }}\release\iris.exe"
          Compress-Archive -Path $binary -DestinationPath "dist\$archive"
          $hash = (Get-FileHash "dist\$archive" -Algorithm SHA256).Hash.ToLower()
          "$hash  $archive" | Out-File "dist\$archive.sha256" -Encoding ascii

      - name: Upload artifact
        uses: actions/upload-artifact@v7
        with:
          name: release-${{ matrix.platform }}
          path: dist/*
          if-no-files-found: error

  release:
    name: Create GitHub draft release
    needs: build
    runs-on: ubuntu-latest

    permissions:
      contents: write

    steps:
      - name: Checkout
        uses: actions/checkout@v7

      - name: Download artifacts
        uses: actions/download-artifact@v8
        with:
          pattern: release-*
          path: dist
          merge-multiple: true

      - name: Create draft release
        uses: softprops/action-gh-release@v3
        with:
          name: IRIS ${{ github.ref_name }}
          draft: true
          body_path: .github/RELEASE_TEMPLATE.md
          fail_on_unmatched_files: true
          files: dist/*