limitdeck 0.1.8

A privacy-safe terminal dashboard for AI subscription limits
name: Release

on:
  push:
    tags:
      - "v*"

permissions:
  contents: write

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    name: Build ${{ matrix.target }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - runner: ubuntu-24.04
            target: x86_64-unknown-linux-gnu
          - runner: ubuntu-24.04-arm
            target: aarch64-unknown-linux-gnu
          - runner: macos-15-intel
            target: x86_64-apple-darwin
          - runner: macos-15
            target: aarch64-apple-darwin
    runs-on: ${{ matrix.runner }}
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}
      - name: Build release binary
        run: cargo build --locked --release --target "${{ matrix.target }}"
      - name: Package archive
        shell: bash
        run: |
          set -euo pipefail
          archive="limitdeck-${{ matrix.target }}.tar.gz"
          staging="$(mktemp -d)"
          cp "target/${{ matrix.target }}/release/limitdeck" "$staging/"
          cp README.md LICENSE "$staging/"
          tar -C "$staging" -czf "$archive" limitdeck README.md LICENSE
          if command -v sha256sum >/dev/null 2>&1; then
            sha256sum "$archive" > "$archive.sha256"
          else
            shasum -a 256 "$archive" > "$archive.sha256"
          fi
      - uses: actions/upload-artifact@v4
        with:
          name: limitdeck-${{ matrix.target }}
          path: |
            limitdeck-${{ matrix.target }}.tar.gz
            limitdeck-${{ matrix.target }}.tar.gz.sha256
          if-no-files-found: error

  release:
    name: Publish GitHub Release
    needs: build
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/download-artifact@v4
        with:
          path: dist
          merge-multiple: true
      - name: Assemble checksums
        shell: bash
        run: cat dist/*.sha256 | sort -k2 > dist/SHA256SUMS
      - name: Publish release assets
        env:
          GH_TOKEN: ${{ github.token }}
        shell: bash
        run: |
          set -euo pipefail
          tag="${GITHUB_REF_NAME}"
          if gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
            gh release upload "$tag" dist/*.tar.gz dist/SHA256SUMS \
              --clobber --repo "$GITHUB_REPOSITORY"
          else
            gh release create "$tag" dist/*.tar.gz dist/SHA256SUMS \
              --verify-tag --generate-notes --title "LimitDeck $tag" \
              --repo "$GITHUB_REPOSITORY"
          fi