dig-dht 0.7.0

Kademlia DHT with provider records for the DIG Node peer network — maps DIG content (store / capsule / root / resource) to the peer_ids holding it, so a node can locate which peers have the content it wants and fetch it over the L7 peer RPC. peer_id = SHA-256(TLS SPKI DER), XOR-distance k-buckets, iterative find_node/find_providers, TTL'd + republished provider records, riding dig-nat mTLS transport.
Documentation
name: Publish to crates.io

# Tag-driven release: pushing a version tag `vX.Y.Z` runs the gates, publishes to crates.io, and
# cuts a GitHub Release. A normal push to `main` runs the gates only (see ci.yml) — it does NOT
# publish. Mirrors the sibling DIG crates (dig-nat / dig-constants / dig-keystore) so the same org
# secrets apply.
#
# RELEASE ORDERING (ecosystem rule: release-first for shared contracts): the published build depends
# on the crates.io `dig-nat` (which itself depends on the crates.io `dig-constants` >=0.2). Both
# dig-constants (>=0.2) and dig-nat must be published to crates.io — and the `git` source for
# `dig-nat` in Cargo.toml swapped for the plain crates.io version — BEFORE dig-dht is published, or
# the publish step (correctly) fails on the unresolved git dependency (`cargo publish` rejects a git
# dependency). The orchestrator sequences the release tags.

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

permissions:
  contents: write

env:
  CARGO_TERM_COLOR: always

jobs:
  # No fmt/clippy/test/coverage gate here on purpose: the PR that produced this tag's commit
  # already ran the full release-gate suite (fmt, clippy, nextest, coverage >=80%) against this
  # exact merged tree (CLAUDE.md §2.4a). Re-running the full test suite at tag-triggered publish
  # time is redundant and is itself a flake-exposure surface that has blocked a release before
  # (#488) — so the tag/deploy path is build + package + publish only (#489).
  publish:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    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 the package builds
        run: cargo build --release

      - name: Verify the package can be packaged
        run: cargo package --locked

      - name: Check CARGO_REGISTRY_TOKEN is set
        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 --locked --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: softprops/action-gh-release@v2
        with:
          tag_name: ${{ github.ref_name }}
          name: "dig-dht v${{ steps.extract_version.outputs.VERSION }}"
          body: |
            ## dig-dht v${{ steps.extract_version.outputs.VERSION }}

            Kademlia DHT with provider records for the DIG Node peer network — maps DIG content
            (store / capsule / root / resource) to the `peer_id`s holding it, so a node can locate
            which peers have the content it wants and fetch it over the L7 peer RPC. XOR-distance
            k-buckets, iterative `find_node` / `find_providers`, TTL'd + republished provider
            records, riding the dig-nat mTLS transport (`peer_id = SHA-256(TLS SPKI DER)`).

            ### Installation
            ```toml
            [dependencies]
            dig-dht = "${{ steps.extract_version.outputs.VERSION }}"
            ```
          draft: false
          prerelease: false