dash-mpd-cli 0.2.32

Download media content from a DASH-MPEG or DASH-WebM MPD manifest.
# TODO: generate artifact attestations for our release builds + container image
#
#     https://docs.github.com/en/actions/how-tos/secure-your-work/use-artifact-attestations/use-artifact-attestations

name: Release

permissions:
  id-token: write
  contents: write
  attestations: write
  artifact-metadata: write


on:
  workflow_dispatch:
  push:
    tags:
      - v[0-9]+.*

jobs:
  release-linux-musl-amd64:
    name: Release for Linux/amd64/musl
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6
      with:
         fetch-depth: 0

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

    - name: Install Musl dev tools
      run: sudo apt-get update && sudo apt-get install musl-dev musl-tools

    - name: Install protobuf compiler
      run: sudo apt-get install protobuf-compiler

    - run: cargo build --release --target x86_64-unknown-linux-musl --features sandbox
    
    - name: Upload binaries to release
      uses: svenstaro/upload-release-action@v2
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        tag: ${{ github.ref }}
        file: target/x86_64-unknown-linux-musl/release/dash-mpd-cli
        asset_name: dash-mpd-cli-linux-amd64
        overwrite: true

    - name: Generate artifact attestation
      uses: actions/attest-build-provenance@v3
      with:
        subject-path: target/x86_64-unknown-linux-musl/release/dash-mpd-cli


  release-linux-aarch64:
    name: Release for Linux/aarch64
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6
      with:
         fetch-depth: 0

    - uses: dtolnay/rust-toolchain@stable
      with:
         targets: aarch64-unknown-linux-gnu

    - name: Install GCC cross-compiler for aarch64
      run: sudo apt-get update && sudo apt-get install gcc-aarch64-linux-gnu

    - name: Install protobuf compiler
      run: sudo apt-get install protobuf-compiler

    - run: |
        export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
        export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc
        export CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++
        cargo build --release --target aarch64-unknown-linux-gnu
    
    - name: Upload binaries to release
      uses: svenstaro/upload-release-action@v2
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        tag: ${{ github.ref }}
        file: target/aarch64-unknown-linux-gnu/release/dash-mpd-cli
        asset_name: dash-mpd-cli-linux-aarch64
        overwrite: true

    - name: Generate artifact attestation
      uses: actions/attest-build-provenance@v3
      with:
        subject-path: target/aarch64-unknown-linux-gnu/release/dash-mpd-cli


  # Some of the GitHub MacOS runners (M1 processor) do not support nested virtualization, so can't
  # run Docker/Podman in a VM.
  release-macos:
    name: Release universal binary for MacOS
    runs-on: macos-26
    steps:
    - uses: actions/checkout@v6
      with:
         fetch-depth: 0

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

    - uses: mlugg/setup-zig@v2

    - run: |
        brew install protobuf
        cargo install --locked cargo-zigbuild
        cargo zigbuild --release --target universal2-apple-darwin

#         podman pull docker.io/messense/cargo-zigbuild
#         podman run --rm \
#           -v ${GITHUB_WORKSPACE}:/io \
#           -w /io docker.io/messense/cargo-zigbuild \
#           brew install cmake && \
#           cargo zigbuild --release --target universal2-apple-darwin

    - name: Upload binaries to release
      uses: svenstaro/upload-release-action@v2
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        tag: ${{ github.ref }}
        file: target/universal2-apple-darwin/release/dash-mpd-cli
        asset_name: dash-mpd-cli-macos
        overwrite: true

    - name: Generate artifact attestation
      uses: actions/attest-build-provenance@v3
      with:
        subject-path: target/universal2-apple-darwin/release/dash-mpd-cli


  release-windows:
    name: Release for Windows/amd64
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v6
      with:
         fetch-depth: 0

    # We need path-type of inherit to include the protoc compiler on the $PATH.
    # See https://github.com/msys2/setup-msys2
    - uses: msys2/setup-msys2@v2
      with:
        msystem: UCRT64
        update: true
        path-type: inherit
        install: base-devel autotools mingw-w64-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-rust mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-podman git

    - name: install protobuf compiler and Podman
      run: choco install --yes --limit-output protoc podman-cli

    - name: install NASM for rustls build
      run: |
         choco install nasm
         echo "C:\Program Files\NASM" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

    - name: initialize Podman for test suite
      run: podman machine init

    - run: cargo build --release
      shell: msys2 {0}
    
    - name: Upload binaries to release
      uses: svenstaro/upload-release-action@v2
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        tag: ${{ github.ref }}
        file: target/release/dash-mpd-cli.exe
        asset_name: dash-mpd-cli-windows.exe
        overwrite: true

    - name: Generate artifact attestation
      uses: actions/attest-build-provenance@v3
      with:
        subject-path: target/release/dash-mpd-cli.exe