xdms 0.2.0

Pure-Rust, dependency-free unpacker for DMS (Disk Masher System) Amiga disk archives into raw ADF disk images.
Documentation
name: Release binaries

# Runs when a GitHub release is published: builds the `xdms-rs` CLI for each
# platform and attaches a packaged archive to that release.
on:
  release:
    types: [published]

permissions:
  contents: write

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    name: ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          # Linux: glibc (native to the build distro) and musl (fully static).
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
          - os: ubuntu-latest
            target: x86_64-unknown-linux-musl
          - os: ubuntu-24.04-arm
            target: aarch64-unknown-linux-gnu
          - os: ubuntu-24.04-arm
            target: aarch64-unknown-linux-musl
          # macOS: universal2 (arm64 + x86_64), both built on this Apple Silicon
          # runner and merged with lipo — no separate Intel runner needed.
          - os: macos-latest
            target: universal2-apple-darwin
          # Windows: x86_64 and ARM64.
          - os: windows-latest
            target: x86_64-pc-windows-msvc
          - os: windows-11-arm
            target: aarch64-pc-windows-msvc
    steps:
      - uses: actions/checkout@v5

      - uses: dtolnay/rust-toolchain@stable

      - name: Build
        shell: bash
        run: |
          set -euo pipefail
          if [ "${{ matrix.target }}" = universal2-apple-darwin ]; then
            # Build both arches on this Apple Silicon runner and merge with lipo.
            rustup target add aarch64-apple-darwin x86_64-apple-darwin
            cargo build --release --bin xdms-rs --target aarch64-apple-darwin
            cargo build --release --bin xdms-rs --target x86_64-apple-darwin
            mkdir -p "target/${{ matrix.target }}/release"
            lipo -create -output "target/${{ matrix.target }}/release/xdms-rs" \
              target/aarch64-apple-darwin/release/xdms-rs \
              target/x86_64-apple-darwin/release/xdms-rs
            lipo -info "target/${{ matrix.target }}/release/xdms-rs"
          else
            rustup target add "${{ matrix.target }}"
            cargo build --release --bin xdms-rs --target "${{ matrix.target }}"
          fi

      - name: Package
        shell: bash
        run: |
          set -euo pipefail
          staging="xdms-rs-${{ matrix.target }}"
          mkdir "$staging"
          if [ "${{ runner.os }}" = "Windows" ]; then
            cp "target/${{ matrix.target }}/release/xdms-rs.exe" "$staging/"
          else
            cp "target/${{ matrix.target }}/release/xdms-rs" "$staging/"
          fi
          cp README.md LICENSE-MIT LICENSE-APACHE "$staging/"
          if [ "${{ runner.os }}" = "Windows" ]; then
            7z a "$staging.zip" "$staging" >/dev/null
            echo "ASSET=$staging.zip" >> "$GITHUB_ENV"
          else
            tar czf "$staging.tar.gz" "$staging"
            echo "ASSET=$staging.tar.gz" >> "$GITHUB_ENV"
          fi

      - name: Attach to release
        shell: bash
        env:
          GH_TOKEN: ${{ github.token }}
        run: gh release upload "${{ github.event.release.tag_name }}" "$ASSET" --clobber