turndb 0.2.0

A content-addressed columnar store for AI traces: byte-exact, embedded, and readable by the CLI and npm from the same file.
Documentation
name: Release CLI npm package

# Publishing `@turndb/cli` and its platform packages: the crate's binary, delivered to people who
# install with npm rather than cargo. A merged Knope release PR or a deliberate manual dispatch
# supplies the exact annotated lockstep tag; the publish job stops at the protected `npm`
# environment for an owner's explicit act, exactly as the crate, native, and wasm releases do.
#
# The binary is built once from the exact-tag checkout, exercised by an install that drives it as a
# consumer would, and then published byte-identically. Both manifests are `private` in source and
# are cleared only by `pack-cli.cjs --release`, so a stray `npm publish` from a working tree
# refuses rather than shipping.
#
# Authentication is npm Trusted Publishing (OIDC): no long-lived registry token is stored here.

on:
  workflow_call:
    inputs:
      release_ref:
        required: true
        type: string
  workflow_dispatch:
    inputs:
      release_ref:
        description: Exact annotated lockstep tag to release (vX.Y.Z)
        required: true
        type: string

concurrency:
  group: release-cli-${{ inputs.release_ref }}
  cancel-in-progress: false

jobs:
  build:
    name: build ${{ matrix.slice }}
    runs-on: ${{ matrix.runner }}
    timeout-minutes: 60
    strategy:
      # No fail-fast: a slice that cannot build is worth seeing on its own rather than as a
      # casualty of whichever sibling failed first.
      fail-fast: false
      matrix:
        include:
          # The reference slice, and the only one that also packs the selector and runs the
          # licence check — both are platform-independent and doing them four times is waste.
          - slice: linux-x64-gnu
            target: x86_64-unknown-linux-gnu
            runner: ubuntu-22.04
            selector: '1'
          # Built on arm64 hardware, not cross-compiled: the install matrix below drives it there.
          - slice: linux-arm64-gnu
            target: aarch64-unknown-linux-gnu
            runner: ubuntu-22.04-arm
            selector: '0'
          # GitHub's explicit Intel and arm64 labels keep the architecture stable as
          # macos-latest moves. Each builds natively on the toolchain that targets it.
          - slice: darwin-x64
            target: x86_64-apple-darwin
            runner: macos-15-intel
            selector: '0'
          - slice: darwin-arm64
            target: aarch64-apple-darwin
            runner: macos-15
            selector: '0'
          - slice: win32-x64-msvc
            target: x86_64-pc-windows-msvc
            runner: windows-latest
            selector: '0'
    steps:
      - uses: actions/checkout@v7
        with:
          ref: ${{ inputs.release_ref }}
          fetch-depth: 0
      # Match rust-toolchain.toml: installing a target on `stable` does not install it for the
      # pinned toolchain that Cargo actually selects from the tagged checkout.
      - uses: dtolnay/rust-toolchain@1.95.0
        with:
          targets: ${{ matrix.target }}
      - uses: actions/setup-node@v4
        with:
          node-version: '24'
      - name: verify exact release tag
        shell: bash
        env:
          RELEASE_REF: ${{ inputs.release_ref }}
        run: |
          test "$(git describe --tags --exact-match HEAD)" = "$RELEASE_REF"
          test "$(git cat-file -t "$RELEASE_REF")" = tag
          case "$RELEASE_REF" in v[0-9]*.[0-9]*.[0-9]*) ;; *) exit 1 ;; esac
      - name: verify lockstep package version matches the tag
        shell: bash
        env:
          RELEASE_REF: ${{ inputs.release_ref }}
        run: test "v$(node -p "require('./cli/package.json').version")" = "$RELEASE_REF"
      - name: install pinned license-report generator
        if: matrix.selector == '1'
        run: cargo install cargo-about --version 0.9.1 --locked --features cli
      - name: verify third-party licenses
        if: matrix.selector == '1'
        run: bash scripts/check-third-party-licenses.sh
      - name: build the binary and pack this slice
        env:
          TURNDB_CLI_TARGET: ${{ matrix.target }}
          TURNDB_CLI_SLICE: ${{ matrix.slice }}
          TURNDB_CLI_PACK_SELECTOR: ${{ matrix.selector }}
        run: node cli/scripts/pack-cli.cjs --release
      # One artifact per slice, merged by the jobs downstream: matrix jobs writing one artifact
      # name race each other for it.
      - uses: actions/upload-artifact@v7
        with:
          name: turndb-cli-${{ inputs.release_ref }}-${{ matrix.slice }}
          path: cli/dist/
          if-no-files-found: error
          retention-days: 7

  # Every architecture that ships a binary drives it from an install before publish. Linux arm64
  # was absent from this matrix through 0.1.8: its slice was published having never been run.
  install:
    name: install release candidate (${{ matrix.runner }}, node ${{ matrix.node }})
    needs: build
    runs-on: ${{ matrix.runner }}
    timeout-minutes: 15
    strategy:
      fail-fast: false
      matrix:
        include:
          - node: '22'
            runner: ubuntu-22.04
          - node: '24'
            runner: ubuntu-22.04
          - node: '26'
            runner: ubuntu-22.04
          - node: '24'
            runner: ubuntu-22.04-arm
          - node: '24'
            runner: windows-latest
    steps:
      - uses: actions/checkout@v7
        with:
          ref: ${{ inputs.release_ref }}
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
      - uses: actions/download-artifact@v4
        with:
          pattern: turndb-cli-${{ inputs.release_ref }}-*
          merge-multiple: true
          path: cli/dist/
      # Drives node_modules/.bin/turndb, not the built binary: the launcher resolving its platform
      # package is the part most likely to be wrong, and only an install exercises it.
      - name: install the exact tarballs and drive the CLI
        run: node cli/scripts/test-cli.cjs cli/dist

  publish:
    name: publish to npm
    needs: [build, install]
    runs-on: ubuntu-22.04
    timeout-minutes: 15
    environment: npm
    permissions:
      contents: read
      id-token: write
    steps:
      - uses: actions/checkout@v7
        with:
          ref: ${{ inputs.release_ref }}
          fetch-depth: 0
      - uses: actions/setup-node@v4
        with:
          node-version: '24'
      - name: install trusted-publishing npm
        run: npm install --global npm@11.5.1
      - uses: actions/download-artifact@v4
        with:
          pattern: turndb-cli-${{ inputs.release_ref }}-*
          merge-multiple: true
          path: dist/
      # Every required tarball and digest is checked before the first registry write. Every
      # platform publishes before the selector; a missing OPTIONAL dependency otherwise looks like
      # a successful npm install while leaving the launcher unable to resolve its binary.
      - name: publish platform packages, then selector
        run: node cli/scripts/publish-cli.cjs dist
        env:
          RELEASE_REF: ${{ inputs.release_ref }}
          TURNDB_RELEASE_APPROVED: 'true'