ffpb 0.2.0

A modern, cli progress bar for ffmpeg
Documentation
name: release

on:
  workflow_dispatch:
    inputs:
      version:
        description: "Release version (e.g., 1.0.0)"
        required: true
        type: string

env:
  CARGO_TERM_COLOR: always
  CARGO_ZIGBUILD_VERSION: "0.22.3"
  ZIG_VERSION: "0.16.0"

jobs:
  build-linux:
    name: ${{ matrix.target }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        target:
          - aarch64-unknown-linux-musl
          - x86_64-unknown-linux-musl
    steps:
      - uses: actions/checkout@v6
      - name: Setup Zig
        run: |
          curl -fsSL "https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-x86_64-linux-${{ env.ZIG_VERSION }}.tar.xz" -o zig.tar.xz
          tar -xf zig.tar.xz -C "${{ runner.temp }}"
          echo "${{ runner.temp }}/zig-x86_64-linux-${{ env.ZIG_VERSION }}" >> $GITHUB_PATH
          rm zig.tar.xz
      - name: Setup cargo-zigbuild
        run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-cross/cargo-zigbuild/releases/download/v${CARGO_ZIGBUILD_VERSION}/cargo-zigbuild-installer.sh | sh
      - name: Add Rust target
        run: rustup target add ${{ matrix.target }}
      - name: Build
        run: cargo zigbuild --release --target ${{ matrix.target }}
      - name: Package
        run: |
          cd target/${{ matrix.target }}/release
          tar -cJf ../../../ffpb-${{ inputs.version }}-${{ matrix.target }}.tar.xz ./ffpb
      - uses: actions/upload-artifact@v7
        with:
          name: ffpb-${{ inputs.version }}-${{ matrix.target }}
          path: ffpb-${{ inputs.version }}-${{ matrix.target }}.tar.xz
          if-no-files-found: error

  build-windows:
    name: ${{ matrix.target }}
    runs-on: windows-latest
    strategy:
      fail-fast: false
      matrix:
        target:
          - aarch64-pc-windows-msvc
          - x86_64-pc-windows-msvc
    steps:
      - uses: actions/checkout@v6
      - name: Add Rust target
        run: rustup target add ${{ matrix.target }}
      - name: Build
        run: cargo build --release --target ${{ matrix.target }}
      - name: Package
        shell: bash
        run: |
          cd target/${{ matrix.target }}/release
          7z a ../../../ffpb-${{ inputs.version }}-${{ matrix.target }}.zip ./ffpb.exe
      - uses: actions/upload-artifact@v7
        with:
          name: ffpb-${{ inputs.version }}-${{ matrix.target }}
          path: ffpb-${{ inputs.version }}-${{ matrix.target }}.zip
          if-no-files-found: error

  build-macos:
    name: aarch64-apple-darwin
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v6
      - name: Add Rust target
        run: rustup target add aarch64-apple-darwin
      - name: Build
        run: cargo build --release --target aarch64-apple-darwin
      - name: Package
        run: |
          cd target/aarch64-apple-darwin/release
          tar -cJf ../../../ffpb-${{ inputs.version }}-aarch64-apple-darwin.tar.xz ./ffpb
      - uses: actions/upload-artifact@v7
        with:
          name: ffpb-${{ inputs.version }}-aarch64-apple-darwin
          path: ffpb-${{ inputs.version }}-aarch64-apple-darwin.tar.xz
          if-no-files-found: error

  release:
    name: Create Release
    needs: [build-linux, build-windows, build-macos]
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/download-artifact@v8
        with:
          path: artifacts
          merge-multiple: true
      - name: List release archives
        run: ls -lah artifacts/
      - name: Create GitHub Release
        uses: softprops/action-gh-release@v3
        with:
          tag_name: ${{ inputs.version }}
          name: ffpb ${{ inputs.version }}
          draft: true
          generate_release_notes: true
          files: artifacts/*