From abcc185dcdc55211bb079fe6b9800d53dba2d4b1 Mon Sep 17 00:00:00 2001 From: gab Date: Tue, 15 Sep 2026 13:41:48 +0200 Subject: [PATCH 1/6] ci: mark test crates and trie-eip1186 as publish = false --- trie-db/test/Cargo.toml | 1 + trie-eip1186/Cargo.toml | 1 + trie-eip1186/test/Cargo.toml | 1 + trie-root/test/Cargo.toml | 1 + 4 files changed, 4 insertions(+) diff --git a/trie-db/test/Cargo.toml b/trie-db/test/Cargo.toml index 4dc0b33f..3b3410b0 100644 --- a/trie-db/test/Cargo.toml +++ b/trie-db/test/Cargo.toml @@ -6,6 +6,7 @@ description = "Tests for trie-db crate" repository = "https://github.com/paritytech/trie" license = "Apache-2.0" edition = "2018" +publish = false [[bench]] name = "bench" diff --git a/trie-eip1186/Cargo.toml b/trie-eip1186/Cargo.toml index 28515bbf..e6439ea0 100644 --- a/trie-eip1186/Cargo.toml +++ b/trie-eip1186/Cargo.toml @@ -6,6 +6,7 @@ description = "EIP-1186 compliant proof generation and verification" repository = "https://github.com/paritytech/trie" license = "Apache-2.0" edition = "2018" +publish = false [dependencies] trie-db = { path = "../trie-db", default-features = false, version = "0.32.0"} diff --git a/trie-eip1186/test/Cargo.toml b/trie-eip1186/test/Cargo.toml index c26c158c..8a2e09ae 100644 --- a/trie-eip1186/test/Cargo.toml +++ b/trie-eip1186/test/Cargo.toml @@ -6,6 +6,7 @@ description = "Tests for trie-eip1186 crate" repository = "https://github.com/paritytech/trie" license = "Apache-2.0" edition = "2018" +publish = false [dependencies] trie-eip1186 = { path = "..", version = "0.5.0"} diff --git a/trie-root/test/Cargo.toml b/trie-root/test/Cargo.toml index 23f99af6..ebad0c58 100644 --- a/trie-root/test/Cargo.toml +++ b/trie-root/test/Cargo.toml @@ -7,6 +7,7 @@ repository = "https://github.com/paritytech/trie" license = "Apache-2.0" categories = [ ] edition = "2018" +publish = false [dependencies] trie-root = { path = "..", version = "0.18.0" } From 5a965bddd823d2292839449d39146a851fe0f6f1 Mon Sep 17 00:00:00 2001 From: gab Date: Tue, 15 Sep 2026 13:50:49 +0200 Subject: [PATCH 2/6] ci: add release workflow publishing through crates_publish_automation --- .github/workflows/release.yml | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..5a1a6d6d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,54 @@ +# Publishes trie's crates to crates.io through paritytech/crates_publish_automation. +# Runs when a GitHub Release is published: packages the crates, uploads them, and +# asks the central workflow to publish whatever crates.io does not have yet. + +name: Release + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + publish: + name: Package & publish to crates.io + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - name: Cargo package + run: | + set -euo pipefail + # Every workspace member without `publish = false`. + crates=$(cargo metadata --no-deps --format-version 1 \ + | jq -r '.packages[] | select(.publish == null) | "-p \(.name)"') + cargo package --exclude-lockfile $crates + + - name: Upload artifacts + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: crates-${{ github.run_attempt }} + path: target/package/*.crate + if-no-files-found: error + + - name: Generate content write token + id: generate-content-write-token + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + with: + client-id: ${{ vars.CRATES_NPM_PUBLISHING_APP_CLIENT_ID }} + private-key: ${{ secrets.CRATES_NPM_PUBLISHING_APP_PRIVATE_KEY }} + owner: paritytech + repositories: crates_publish_automation + permission-actions: write + + - name: Trigger publishing in the crates_publish_automation repo + uses: octokit/request-action@b91aabaa861c777dcdb14e2387e30eddf04619ae # v3.0.0 + with: + route: POST /repos/paritytech/crates_publish_automation/actions/workflows/publish.yml/dispatches + ref: main + inputs: '${{ format(''{{ "repo": "{0}", "run_id": "{1}", "artifact_name": "crates-{2}" }}'', github.repository, github.run_id, github.run_attempt) }}' + env: + GITHUB_TOKEN: ${{ steps.generate-content-write-token.outputs.token }} From 78b3c64dfd540b0fb72efd4f2f5eda579534bf70 Mon Sep 17 00:00:00 2001 From: gab Date: Tue, 15 Sep 2026 13:55:00 +0200 Subject: [PATCH 3/6] docs: describe releasing through crates_publish_automation --- CONTRIBUTING.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c7f0ea1e..5f186f17 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,13 +34,20 @@ Bumping versions should be done in a separate from regular code changes PR. This part of the guidelines is for `trie` maintainers. -When making a new release make sure to follow these steps: -* Submit a PR with a version bump and list all major and breaking changes in the crate's changelog - -After the PR is merged into master: -* `cargo publish` on the latest master (try with `--dry-run` first) -* Add a git tag in format `-v`, -e.g. `git tag trie-db-v0.2.2` and push it with `git push origin trie-db-v0.2.2` +Crates are published by paritytech/crates_publish_automation as `parity-crate-owner`. + +1. Merge a PR that bumps the version of each crate being released and of the + workspace crates depending on it, and turns `## [Unreleased]` in their + changelogs into `## [X.Y.Z] - YYYY-MM-DD`. +2. Publish a GitHub Release from `master` with tag `-vX.Y.Z` for the + main crate released (`trie-db` whenever it is bumped) and the changelog + entries as notes. For a patch of an old line, target its `backport/` + branch instead and untick "Set as the latest release", the branch must + contain `.github/workflows/release.yml`. +3. The `Release` workflow packages the crates and hands them to the publisher, + which publishes the versions crates.io does not have yet. Check crates.io. + If it fails, an issue labelled `failure` is opened here, fix the cause and + re-run the workflow, already published versions are skipped. ## Conduct From ecd776e1b1630b1ffcc92651a47ff14f13cc6d02 Mon Sep 17 00:00:00 2001 From: gab Date: Wed, 16 Sep 2026 14:43:18 +0200 Subject: [PATCH 4/6] ci: overwrite the release artifact on re-runs --- .github/workflows/release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5a1a6d6d..95116707 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,9 +30,10 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: crates-${{ github.run_attempt }} + name: crates path: target/package/*.crate if-no-files-found: error + overwrite: true - name: Generate content write token id: generate-content-write-token @@ -49,6 +50,6 @@ jobs: with: route: POST /repos/paritytech/crates_publish_automation/actions/workflows/publish.yml/dispatches ref: main - inputs: '${{ format(''{{ "repo": "{0}", "run_id": "{1}", "artifact_name": "crates-{2}" }}'', github.repository, github.run_id, github.run_attempt) }}' + inputs: '${{ format(''{{ "repo": "{0}", "run_id": "{1}" }}'', github.repository, github.run_id) }}' env: GITHUB_TOKEN: ${{ steps.generate-content-write-token.outputs.token }} From cea28f5fd4964f466eaaed067f02f1653993a8ed Mon Sep 17 00:00:00 2001 From: gab Date: Thu, 17 Sep 2026 11:11:03 +0200 Subject: [PATCH 5/6] ci: hold back the crates not yet owned by parity-crate-owner --- test-support/keccak-hasher/Cargo.toml | 3 +++ test-support/reference-trie/Cargo.toml | 3 +++ test-support/trie-standardmap/Cargo.toml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/test-support/keccak-hasher/Cargo.toml b/test-support/keccak-hasher/Cargo.toml index d933d44d..e4f261c7 100644 --- a/test-support/keccak-hasher/Cargo.toml +++ b/test-support/keccak-hasher/Cargo.toml @@ -1,5 +1,8 @@ [package] name = "keccak-hasher" +# NOTE: do not bump this version. `parity-crate-owner` does not own this crate +# on crates.io yet, so the release workflow cannot publish a new version of it. +# If a bump is unavoidable it has to be published by hand. version = "0.16.0" authors = ["Parity Technologies "] description = "Keccak-256 implementation of the Hasher trait" diff --git a/test-support/reference-trie/Cargo.toml b/test-support/reference-trie/Cargo.toml index 93beb4e8..91ec2132 100644 --- a/test-support/reference-trie/Cargo.toml +++ b/test-support/reference-trie/Cargo.toml @@ -1,5 +1,8 @@ [package] name = "reference-trie" +# NOTE: do not bump this version. `parity-crate-owner` does not own this crate +# on crates.io yet, so the release workflow cannot publish a new version of it. +# If a bump is unavoidable it has to be published by hand. version = "0.29.3" authors = ["Parity Technologies "] description = "Simple reference trie format" diff --git a/test-support/trie-standardmap/Cargo.toml b/test-support/trie-standardmap/Cargo.toml index b1d2d199..8bb04dfb 100644 --- a/test-support/trie-standardmap/Cargo.toml +++ b/test-support/trie-standardmap/Cargo.toml @@ -1,6 +1,9 @@ [package] name = "trie-standardmap" description = "Standard test map for profiling tries" +# NOTE: do not bump this version. `parity-crate-owner` does not own this crate +# on crates.io yet, so the release workflow cannot publish a new version of it. +# If a bump is unavoidable it has to be published by hand. version = "0.16.0" authors = ["Parity Technologies "] license = "Apache-2.0" From 845f611612cb6125b0f045553165d6200857855e Mon Sep 17 00:00:00 2001 From: gab Date: Tue, 22 Sep 2026 10:10:39 +0200 Subject: [PATCH 6/6] refactor: remove stale comments --- test-support/keccak-hasher/Cargo.toml | 3 --- test-support/reference-trie/Cargo.toml | 3 --- test-support/trie-standardmap/Cargo.toml | 3 --- 3 files changed, 9 deletions(-) diff --git a/test-support/keccak-hasher/Cargo.toml b/test-support/keccak-hasher/Cargo.toml index e4f261c7..d933d44d 100644 --- a/test-support/keccak-hasher/Cargo.toml +++ b/test-support/keccak-hasher/Cargo.toml @@ -1,8 +1,5 @@ [package] name = "keccak-hasher" -# NOTE: do not bump this version. `parity-crate-owner` does not own this crate -# on crates.io yet, so the release workflow cannot publish a new version of it. -# If a bump is unavoidable it has to be published by hand. version = "0.16.0" authors = ["Parity Technologies "] description = "Keccak-256 implementation of the Hasher trait" diff --git a/test-support/reference-trie/Cargo.toml b/test-support/reference-trie/Cargo.toml index 91ec2132..93beb4e8 100644 --- a/test-support/reference-trie/Cargo.toml +++ b/test-support/reference-trie/Cargo.toml @@ -1,8 +1,5 @@ [package] name = "reference-trie" -# NOTE: do not bump this version. `parity-crate-owner` does not own this crate -# on crates.io yet, so the release workflow cannot publish a new version of it. -# If a bump is unavoidable it has to be published by hand. version = "0.29.3" authors = ["Parity Technologies "] description = "Simple reference trie format" diff --git a/test-support/trie-standardmap/Cargo.toml b/test-support/trie-standardmap/Cargo.toml index 8bb04dfb..b1d2d199 100644 --- a/test-support/trie-standardmap/Cargo.toml +++ b/test-support/trie-standardmap/Cargo.toml @@ -1,9 +1,6 @@ [package] name = "trie-standardmap" description = "Standard test map for profiling tries" -# NOTE: do not bump this version. `parity-crate-owner` does not own this crate -# on crates.io yet, so the release workflow cannot publish a new version of it. -# If a bump is unavoidable it has to be published by hand. version = "0.16.0" authors = ["Parity Technologies "] license = "Apache-2.0"