dig-peer 0.4.1

The DIG Network peer client: DigPeer::connect(peer, tls) drives dig-nat's full direct→relay traversal ladder, exposes typed RPC over dig-rpc-protocol, seals directed calls end-to-end to the peer's captured BLS-G1 identity (§5.4) on top of mTLS, and disconnects cleanly. The client mirror of dig-rpc's server; distinct from ChiaPeer.
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-constants / dig-keystore / dig-nat) so the same org
# secrets apply. dig-peer is an L20 domain crate; its DIG dependencies (dig-nat, dig-message,
# dig-rpc-protocol, dig-tls) are ALL already published on crates.io, so it publishes after them per
# the release-first ordering (§4.1) with no git deps.
#
# `workflow_dispatch` is present so a NEW crate's first release can be kicked manually — GitHub does
# not fire a tag-push workflow for a tag created before the workflow file existed on the default
# branch (the new-crate first-release race).

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 re-run here: the PR that produced this tagged commit already went
  # through ci.yml's full gate set before merge — re-running only re-tests the same tree and delays
  # the release. This workflow is build + package + publish only.
  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-peer v${{ steps.extract_version.outputs.VERSION }}"
          body: |
            ## dig-peer v${{ steps.extract_version.outputs.VERSION }}

            The canonical DIG peer mTLS crate: the shipped public DigNetwork CA, per-peer node
            certificate generation signed by that CA, rustls mutual-auth `ServerConfig`/`ClientConfig`
            builders (chain-to-DigNetwork-CA + `peer_id` pinning + the #1204 BLS-G1 cert binding), and
            `peer_id = SHA-256(TLS SPKI DER)`.

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