asobi 0.6.3

A persistent, project-local knowledge graph CLI for AI agents.
Documentation
name: Release

on:
  push:
    tags:
      - "v*"

permissions:
  contents: write

env:
  FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
  publish-crate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: jdx/mise-action@v2
      - name: Verify tag matches package version
        shell: bash
        run: |
          tag_version="${GITHUB_REF_NAME#v}"
          package_version="$(awk -F'"' '/^version = / { print $2; exit }' Cargo.toml)"
          test "$tag_version" = "$package_version" || {
            echo "tag $tag_version does not match Cargo.toml version $package_version" >&2
            exit 1
          }
      - name: Verify package
        run: cargo publish --locked --dry-run
      - name: Publish to crates.io
        run: cargo publish --locked --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
      - name: Create GitHub release
        # Created once, here, rather than by the per-OS upload step below --
        # two matrix jobs racing to create the same release is exactly the
        # kind of thing that turns a transient network blip into a permanent
        # half-published release. `gh release view` as a fallback makes this
        # step idempotent on a re-run after a partial failure.
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --generate-notes || gh release view "$GITHUB_REF_NAME"

  release-binaries:
    needs: publish-crate
    strategy:
      fail-fast: false
      # Native runners per target keep release builds predictable. The shipped
      # 0.6 product has one SQLite binary with no feature-specific variants.
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
          - os: macos-14
            target: aarch64-apple-darwin
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - uses: jdx/mise-action@v2

      - name: Build lean binary
        run: cargo build --release --locked --target ${{ matrix.target }}
      - name: Package lean binary
        run: tar -czf "asobi-${{ matrix.target }}.tar.gz" -C "target/${{ matrix.target }}/release" asobi

      - name: Upload to release
        # The macOS runner's connection to api.github.com is intermittently
        # flaky (connect timeouts, not an auth or content problem) -- retry a
        # few times with backoff rather than failing the whole release on a
        # transient network blip. `--clobber` makes a retry after a partial
        # upload safe to repeat.
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          for attempt in 1 2 3 4 5; do
            if gh release upload "$GITHUB_REF_NAME" "asobi-${{ matrix.target }}.tar.gz" --clobber; then
              exit 0
            fi
            echo "upload attempt $attempt failed; retrying in 15s..." >&2
            sleep 15
          done
          echo "upload failed after 5 attempts" >&2
          exit 1