ring-db 0.6.0

A Rust library for ring queries in high-dimensional vector spaces.
Documentation
name: Publish crate

on:
  push:
    tags:
      - 'v*.*.*'
  workflow_dispatch:

permissions:
  contents: write

concurrency:
  group: publish-${{ github.ref }}
  cancel-in-progress: false

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable

      - name: Cache Cargo registry and build artifacts
        uses: Swatinem/rust-cache@v2

      - name: Run test suite
        run: cargo test --locked

      - name: Verify publish ring-db-derive (dry-run)
        run: cargo publish -p ring-db-derive --locked --dry-run
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_KEY }}

      - name: Publish ring-db-derive to crates.io
        run: cargo publish -p ring-db-derive --locked
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_KEY }}

      - name: Wait for crates.io to index ring-db-derive
        run: sleep 30

      - name: Verify publish ring-db (dry-run)
        run: cargo publish -p ring-db --locked --dry-run
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_KEY }}

      - name: Publish ring-db to crates.io
        run: cargo publish -p ring-db --locked
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_KEY }}

  release:
    needs: publish
    if: startsWith(github.ref, 'refs/tags/')
    runs-on: ubuntu-latest
    steps:
      - name: Create GitHub release
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GH_REPO: ${{ github.repository }}
        run: |
          tag="${GITHUB_REF_NAME}"

          if gh release view "$tag" --repo "$GH_REPO" >/dev/null 2>&1; then
            gh release edit "$tag" --repo "$GH_REPO" --title "$tag" --notes ""
          else
            gh release create "$tag" --repo "$GH_REPO" --title "$tag" --notes ""
          fi