amagi 0.1.4

Rust SDK, CLI, and Web API service skeleton for multi-platform social web adapters.
Documentation
name: Daily Build

on:
  schedule:
    - cron: '0 0 * * *'
  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref_name || 'scheduled' }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always
  BUILD_TYPE: daily
  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/checkout@v4
        with:
          fetch-depth: 0

      - uses: actions/download-artifact@v4
        with:
          path: dist
          merge-multiple: true

      - name: Delete old release
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh release delete daily --cleanup-tag -y || true
          git push --delete origin daily || true

      - name: Update Daily Tag
        run: |
          git tag -f daily
          git push -f origin daily

      - name: Release
        uses: softprops/action-gh-release@v2
        with:
          tag_name: daily
          name: Daily Build
          body: "Automated daily build from latest code. Updated daily at UTC 00:00."
          prerelease: true
          files: dist/*