name: release

on:
  push:
    tags:
      - "v*"

permissions:
  contents: write

jobs:
  build-linux-musl:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: x86_64-unknown-linux-musl

      - name: Build release (static musl)
        run: cargo build --release --target x86_64-unknown-linux-musl

      - name: Package binary
        run: |
          mkdir -p dist
          cp target/x86_64-unknown-linux-musl/release/ccache-tui dist/ccache-tui-linux-x86_64-musl

      - name: Upload release assets
        uses: softprops/action-gh-release@v2
        with:
          files: dist/ccache-tui-linux-x86_64-musl
