amagi 0.1.4

Rust SDK, CLI, and Web API service skeleton for multi-platform social web adapters.
Documentation
# Build and release binaries for multiple platforms
name: Release

on:
  push:
    tags:
      - 'v*'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always
  BUILD_TYPE: release
  BIN_NAME: amagi

jobs:
  build:
    name: ${{ matrix.name }}
    permissions:
      contents: read
    runs-on: ${{ matrix.os }}
    timeout-minutes: 45
    strategy:
      fail-fast: false
      matrix:
        include:
          - name: linux-x86_64-gnu
            os: ubuntu-22.04
            target: x86_64-unknown-linux-gnu
            artifact: amagi-x86_64-unknown-linux-gnu.tar.gz
          - name: linux-aarch64-gnu
            os: ubuntu-22.04
            target: aarch64-unknown-linux-gnu
            artifact: amagi-aarch64-unknown-linux-gnu.tar.gz
            cross: true
          - name: linux-x86_64-musl
            os: ubuntu-22.04
            target: x86_64-unknown-linux-musl
            artifact: amagi-x86_64-unknown-linux-musl.tar.gz
            cross: true
          - name: linux-aarch64-musl
            os: ubuntu-22.04
            target: aarch64-unknown-linux-musl
            artifact: amagi-aarch64-unknown-linux-musl.tar.gz
            cross: true
          - name: macos-x86_64
            os: macos-15-intel
            target: x86_64-apple-darwin
            artifact: amagi-x86_64-apple-darwin.tar.gz
          - name: macos-aarch64
            os: macos-14
            target: aarch64-apple-darwin
            artifact: amagi-aarch64-apple-darwin.tar.gz
          - name: windows-x86_64-msvc
            os: windows-2022
            target: x86_64-pc-windows-msvc
            artifact: amagi-x86_64-pc-windows-msvc.zip

    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Install cross
        if: matrix.cross
        uses: taiki-e/install-action@cross

      - name: Cache Rust dependencies
        uses: Swatinem/rust-cache@v2

      - name: Build
        shell: bash
        run: |
          if [ "${{ matrix.cross }}" = "true" ]; then
            cross build --release --locked --bin "$BIN_NAME" --target ${{ matrix.target }}
          else
            cargo build --release --locked --bin "$BIN_NAME" --target ${{ matrix.target }}
          fi

      - name: Package (tar.gz)
        if: runner.os != 'Windows'
        run: tar -czvf ${{ matrix.artifact }} -C target/${{ matrix.target }}/release ${{ env.BIN_NAME }}

      - name: Package (zip)
        if: runner.os == 'Windows'
        run: Compress-Archive -Path target/${{ matrix.target }}/release/${{ env.BIN_NAME }}.exe -DestinationPath ${{ matrix.artifact }}

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

  release:
    needs: build
    permissions:
      contents: write
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/download-artifact@v4
        with:
          path: dist
          merge-multiple: true

      - name: Release
        uses: softprops/action-gh-release@v2
        with:
          files: dist/*
          generate_release_notes: true