a3s 0.1.4

a3s — umbrella CLI for the A3S platform; dispatches `a3s <tool>` to the matching `a3s-<tool>` binary
name: Release
on:
  push:
    tags: ["v*"]
permissions:
  contents: write
jobs:
  create-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Create GitHub release
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1 \
            || gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" \
                 --notes "a3s ${GITHUB_REF_NAME} — umbrella CLI dispatcher" --verify-tag
  binaries:
    needs: create-release
    strategy:
      fail-fast: false
      matrix:
        include:
          - target: aarch64-apple-darwin
            os: macos-latest
          - target: x86_64-apple-darwin
            os: macos-latest
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
          - target: aarch64-unknown-linux-gnu
            os: ubuntu-latest
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - uses: taiki-e/upload-rust-binary-action@v1
        with:
          bin: a3s
          target: ${{ matrix.target }}
          archive: a3s-$tag-$target
          token: ${{ secrets.GITHUB_TOKEN }}
  crate:
    needs: create-release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - name: Publish to crates.io (if token configured)
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: |
          if [ -n "${CARGO_REGISTRY_TOKEN:-}" ]; then cargo publish; else echo "no CARGO_REGISTRY_TOKEN — skipping crates.io"; fi