dig-blockstore 0.1.2

DIG L2 block persistence — RocksDB-backed block store with canonical chain indexing
name: Publish to crates.io

on:
  push:
    tags:
      - 'v*'
  workflow_dispatch:
    inputs:
      version:
        description: 'Version to publish (e.g., v0.1.0)'
        required: true
        type: string

env:
  CARGO_TERM_COLOR: always

jobs:
  # No test-suite re-run here (CLAUDE.md #489): the PR-time `ci.yml` gate (fmt, clippy, nextest
  # w/ coverage, doc) already tested the exact merged tree this tag points at. Re-running the full
  # suite again at deploy time is redundant and is itself a flake-exposure surface that has blocked
  # a release (#488) — deploy is build + package + publish only.
  publish:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

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

      - name: Cache dependencies
        uses: Swatinem/rust-cache@v2

      - name: Verify package can be built
        run: cargo build --release

      - name: Verify package can be packaged
        run: cargo package --allow-dirty

      - name: Check if CARGO_REGISTRY_TOKEN is available
        run: |
          if [ -z "${{ secrets.CARGO_REGISTRY_TOKEN }}" ]; then
            echo "CARGO_REGISTRY_TOKEN secret is not set in repository settings"
            exit 1
          fi

      - name: Publish to crates.io
        run: cargo publish --allow-dirty --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

  create-release:
    name: Create GitHub Release
    runs-on: ubuntu-latest
    needs: publish
    if: startsWith(github.ref, 'refs/tags/v')
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Extract version from tag
        id: extract_version
        run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT

      - name: Create GitHub Release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: "dig-blockstore v${{ steps.extract_version.outputs.VERSION }}"
          body: |
            ## dig-blockstore v${{ steps.extract_version.outputs.VERSION }}

            Persistent block storage for the DIG L2 network. RocksDB-backed with six column
            families, dual-layer canonical chain indexing (memory-mapped file + RocksDB),
            sharded in-memory LRU caches, zstd compression with trained dictionaries, an async
            write pipeline, rollback/reorg support, checkpoint storage, pruning, and snapshot
            export/import.

            ### Installation
            ```toml
            [dependencies]
            dig-blockstore = "${{ steps.extract_version.outputs.VERSION }}"
            ```

            See the [README](https://github.com/DIG-Network/dig-blockstore/blob/main/README.md) for usage instructions.
          draft: false
          prerelease: false