Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 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
path: target/package/*.crate
if-no-files-found: error
overwrite: true

- 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}" }}'', github.repository, github.run_id) }}'
env:
GITHUB_TOKEN: ${{ steps.generate-content-write-token.outputs.token }}
21 changes: 14 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<crate-name>-v<version>`,
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 `<crate>-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/<line>`
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

Expand Down
1 change: 1 addition & 0 deletions trie-db/test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions trie-eip1186/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
1 change: 1 addition & 0 deletions trie-eip1186/test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
1 change: 1 addition & 0 deletions trie-root/test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
Loading