graph_d 1.3.2

A native graph database implementation in Rust with built-in JSON support and SQLite-like simplicity
Documentation
# ═══════════════════════════════════════════════════════════════════════════════
# Release Workflow - Optimized for Speed
# ═══════════════════════════════════════════════════════════════════════════════
# Satisfies: RT-4 (Semantic release pipeline)
# Satisfies: RT-5 (Cross-platform binary distribution)
#
# Workflow:
# 1. release-please creates/updates release PR on push to main
# 2. When release PR is merged, it creates a GitHub release
# 3. cargo-dist builds binaries for all platforms IN PARALLEL
# 4. Binaries are uploaded as release assets
# 5. Package is published to crates.io (runs in parallel with builds)
# ═══════════════════════════════════════════════════════════════════════════════

name: Release

on:
  push:
    branches:
      - main
  workflow_dispatch:

permissions:
  contents: write
  pull-requests: write

env:
  CARGO_TERM_COLOR: always
  CARGO_INCREMENTAL: 0

jobs:
  # ─────────────────────────────────────────────────────────────────────────────
  # Release Please - Creates release PRs and GitHub releases
  # ─────────────────────────────────────────────────────────────────────────────
  release-please:
    name: Release Please
    runs-on: ubuntu-latest
    outputs:
      release_created: ${{ steps.release.outputs.release_created }}
      tag_name: ${{ steps.release.outputs.tag_name }}
      version: ${{ steps.release.outputs.version }}
    steps:
      - name: Release Please
        id: release
        uses: googleapis/release-please-action@v4
        with:
          release-type: rust

  # ─────────────────────────────────────────────────────────────────────────────
  # Build Binaries - Cross-platform builds run in PARALLEL
  # ─────────────────────────────────────────────────────────────────────────────
  build-binaries:
    name: Build (${{ matrix.target }})
    needs: release-please
    if: ${{ needs.release-please.outputs.release_created == 'true' }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
          - target: x86_64-apple-darwin
            os: macos-latest
          - target: aarch64-apple-darwin
            os: macos-latest
          - target: x86_64-pc-windows-msvc
            os: windows-latest
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4

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

      - uses: Swatinem/rust-cache@v2
        with:
          prefix-key: "v1-release"
          cache-on-failure: true

      - name: Build Binary
        run: cargo build --release --features cli --target ${{ matrix.target }}

      - name: Package Binary (Unix)
        if: runner.os != 'Windows'
        run: |
          cd target/${{ matrix.target }}/release
          tar -czvf graph_d-${{ needs.release-please.outputs.version }}-${{ matrix.target }}.tar.gz graph_d
          shasum -a 256 graph_d-${{ needs.release-please.outputs.version }}-${{ matrix.target }}.tar.gz > graph_d-${{ needs.release-please.outputs.version }}-${{ matrix.target }}.tar.gz.sha256

      - name: Package Binary (Windows)
        if: runner.os == 'Windows'
        shell: pwsh
        run: |
          cd target/${{ matrix.target }}/release
          Compress-Archive -Path graph_d.exe -DestinationPath graph_d-${{ needs.release-please.outputs.version }}-${{ matrix.target }}.zip
          Get-FileHash graph_d-${{ needs.release-please.outputs.version }}-${{ matrix.target }}.zip -Algorithm SHA256 | ForEach-Object { "$($_.Hash.ToLower())  graph_d-${{ needs.release-please.outputs.version }}-${{ matrix.target }}.zip" } > graph_d-${{ needs.release-please.outputs.version }}-${{ matrix.target }}.zip.sha256

      - name: Upload Release Assets
        uses: softprops/action-gh-release@v1
        with:
          tag_name: ${{ needs.release-please.outputs.tag_name }}
          files: |
            target/${{ matrix.target }}/release/graph_d-*

  # ─────────────────────────────────────────────────────────────────────────────
  # Publish to crates.io - Runs in PARALLEL with build-binaries
  # ─────────────────────────────────────────────────────────────────────────────
  publish-crates:
    name: Publish to crates.io
    needs: release-please
    if: ${{ needs.release-please.outputs.release_created == 'true' }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - name: Publish to crates.io
        run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}

  # ─────────────────────────────────────────────────────────────────────────────
  # Post-Release Validation
  # ─────────────────────────────────────────────────────────────────────────────
  validate-release:
    name: Validate Release
    needs: [release-please, publish-crates]
    if: ${{ needs.release-please.outputs.release_created == 'true' }}
    runs-on: ubuntu-latest
    steps:
      - name: Wait for crates.io indexing
        run: sleep 30

      - name: Verify crates.io publication
        run: |
          cargo search graph_d | grep -q "graph_d"
          echo "✅ Package found on crates.io"

      - name: Test cargo install
        run: |
          cargo install graph_d --features cli --version ${{ needs.release-please.outputs.version }}
          graph_d --version
          echo "✅ CLI installation successful"