dapctl 1.0.1

TUI/CLI sync tool for HiFi Digital Audio Players
Documentation
name: Release

on:
  push:
    tags:
      - 'v*'

env:
  CARGO_TERM_COLOR: always
  FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
  # ── Linux x86_64 + aarch64 (native runners, glibc) ───────────────────────────
  build-linux:
    name: Linux (${{ matrix.target }})
    runs-on: ${{ matrix.runner }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - target: x86_64-unknown-linux-gnu
            runner: ubuntu-latest
          - target: aarch64-unknown-linux-gnu
            runner: ubuntu-24.04-arm

    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable

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

      - name: Install audio build dependencies
        run: sudo apt-get update && sudo apt-get install -y libasound2-dev pkg-config

      - name: Build
        run: cargo build --release

      - name: Package
        run: |
          ARCHIVE="dapctl-${{ github.ref_name }}-${{ matrix.target }}.tar.gz"
          tar -czf "$ARCHIVE" -C target/release dapctl
          echo "ARCHIVE=$ARCHIVE" >> "$GITHUB_ENV"

      - uses: actions/upload-artifact@v4
        with:
          name: ${{ matrix.target }}
          path: ${{ env.ARCHIVE }}

  # ── macOS universal binary (x86_64 + arm64 via lipo) ─────────────────────────
  build-macos:
    name: macOS (universal)
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: x86_64-apple-darwin,aarch64-apple-darwin

      - uses: Swatinem/rust-cache@v2

      - name: Build x86_64
        run: cargo build --release --target x86_64-apple-darwin

      - name: Build aarch64
        run: cargo build --release --target aarch64-apple-darwin

      - name: Create universal binary + package
        run: |
          lipo -create \
            target/x86_64-apple-darwin/release/dapctl \
            target/aarch64-apple-darwin/release/dapctl \
            -output dapctl
          ARCHIVE="dapctl-${{ github.ref_name }}-universal-apple-darwin.tar.gz"
          tar -czf "$ARCHIVE" dapctl
          echo "ARCHIVE=$ARCHIVE" >> "$GITHUB_ENV"

      - uses: actions/upload-artifact@v4
        with:
          name: universal-apple-darwin
          path: ${{ env.ARCHIVE }}

  # ── Windows x86_64 (MSVC) ────────────────────────────────────────────────────
  build-windows:
    name: Windows (x86_64)
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable

      - uses: Swatinem/rust-cache@v2

      - name: Build
        run: cargo build --release

      - name: Package
        shell: pwsh
        run: |
          $archive = "dapctl-${{ github.ref_name }}-x86_64-pc-windows-msvc.zip"
          Compress-Archive -Path target\release\dapctl.exe -DestinationPath $archive
          "ARCHIVE=$archive" | Out-File -FilePath $env:GITHUB_ENV -Append

      - uses: actions/upload-artifact@v4
        with:
          name: x86_64-pc-windows-msvc
          path: ${{ env.ARCHIVE }}

  # ── Publish GitHub release (draft) ───────────────────────────────────────────
  release:
    name: Publish release
    needs: [build-linux, build-macos, build-windows]
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/download-artifact@v4
        with:
          merge-multiple: true
          path: artifacts/

      - name: SHA-256 checksums
        run: |
          cd artifacts
          sha256sum * > SHA256SUMS.txt
          cat SHA256SUMS.txt

      - uses: softprops/action-gh-release@v2
        with:
          draft: true
          generate_release_notes: true
          files: artifacts/*