From a9b47d0647aad57a5ebd0a5ee313b8c071efcf77 Mon Sep 17 00:00:00 2001 From: fannnzhang Date: Fri, 12 Jun 2026 11:10:17 +0800 Subject: [PATCH] Prepare v0.1.1 release publishing --- .github/workflows/publish.yml | 55 ++++++++++++++++++++++++++++++----- Cargo.lock | 16 +++++----- Cargo.toml | 16 +++++----- README.md | 6 ++-- docs/release-process.md | 33 ++++++++++++--------- scripts/publish-crates.sh | 25 +++++++++++----- 6 files changed, 103 insertions(+), 48 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d228c40..d85042d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,12 +1,15 @@ name: Publish Crates on: + push: + tags: + - "v*" workflow_dispatch: inputs: version: description: Workspace version to publish required: true - default: "0.1.0" + default: "0.1.1" dry_run: description: Run package preflight instead of publishing required: true @@ -41,11 +44,47 @@ jobs: - name: Cache cargo artifacts uses: Swatinem/rust-cache@v2 + - name: Resolve release inputs + id: release-inputs + env: + EVENT_NAME: ${{ github.event_name }} + MANUAL_VERSION: ${{ inputs.version }} + MANUAL_DRY_RUN: ${{ inputs.dry_run }} + MANUAL_START_AT: ${{ inputs.start_at }} + run: | + set -euo pipefail + + if [[ "$EVENT_NAME" == "push" ]]; then + if [[ "$GITHUB_REF" != refs/tags/v* ]]; then + echo "tag publish must run from refs/tags/v; got ${GITHUB_REF}" >&2 + exit 1 + fi + + version="${GITHUB_REF#refs/tags/v}" + if [[ ! "$version" =~ ^[0-9]+[.][0-9]+[.][0-9]+([-+][0-9A-Za-z.-]+)?$ ]]; then + echo "release tag must be v; got ${GITHUB_REF}" >&2 + exit 1 + fi + + dry_run=false + start_at="" + else + version="$MANUAL_VERSION" + dry_run="${MANUAL_DRY_RUN:-true}" + start_at="$MANUAL_START_AT" + fi + + { + echo "version=${version}" + echo "dry_run=${dry_run}" + echo "start_at=${start_at}" + } >> "$GITHUB_OUTPUT" + - name: Verify release inputs env: - INPUT_VERSION: ${{ inputs.version }} - DRY_RUN: ${{ inputs.dry_run }} - START_AT: ${{ inputs.start_at }} + INPUT_VERSION: ${{ steps.release-inputs.outputs.version }} + DRY_RUN: ${{ steps.release-inputs.outputs.dry_run }} + START_AT: ${{ steps.release-inputs.outputs.start_at }} CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} run: | set -euo pipefail @@ -61,9 +100,9 @@ jobs: fi - name: Package preflight - if: ${{ inputs.dry_run }} + if: ${{ steps.release-inputs.outputs.dry_run == 'true' }} env: - START_AT: ${{ inputs.start_at }} + START_AT: ${{ steps.release-inputs.outputs.start_at }} run: | if [[ -n "$START_AT" ]]; then scripts/publish-crates.sh --dry-run --start-at "$START_AT" @@ -72,10 +111,10 @@ jobs: fi - name: Publish crates - if: ${{ !inputs.dry_run }} + if: ${{ steps.release-inputs.outputs.dry_run != 'true' }} env: CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} - START_AT: ${{ inputs.start_at }} + START_AT: ${{ steps.release-inputs.outputs.start_at }} run: | if [[ -n "$START_AT" ]]; then scripts/publish-crates.sh --publish --start-at "$START_AT" diff --git a/Cargo.lock b/Cargo.lock index 3567d7d..8652ecd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1143,7 +1143,7 @@ checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" [[package]] name = "openwire" -version = "0.1.0" +version = "0.1.1" dependencies = [ "async-compression", "base64", @@ -1178,7 +1178,7 @@ dependencies = [ [[package]] name = "openwire-cache" -version = "0.1.0" +version = "0.1.1" dependencies = [ "async-trait", "bytes", @@ -1194,7 +1194,7 @@ dependencies = [ [[package]] name = "openwire-core" -version = "0.1.0" +version = "0.1.1" dependencies = [ "bytes", "futures-core", @@ -1215,7 +1215,7 @@ dependencies = [ [[package]] name = "openwire-fastwebsockets" -version = "0.1.0" +version = "0.1.1" dependencies = [ "bytes", "fastwebsockets", @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "openwire-rustls" -version = "0.1.0" +version = "0.1.1" dependencies = [ "bytes", "futures-util", @@ -1252,7 +1252,7 @@ dependencies = [ [[package]] name = "openwire-test" -version = "0.1.0" +version = "0.1.1" dependencies = [ "bytes", "futures-util", @@ -1271,7 +1271,7 @@ dependencies = [ [[package]] name = "openwire-tokio" -version = "0.1.0" +version = "0.1.1" dependencies = [ "hyper", "openwire-core", @@ -1282,7 +1282,7 @@ dependencies = [ [[package]] name = "openwire-tungstenite" -version = "0.1.0" +version = "0.1.1" dependencies = [ "bytes", "futures-util", diff --git a/Cargo.toml b/Cargo.toml index 1afabe3..0890c3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ resolver = "2" [workspace.package] edition = "2021" license = "MIT" -version = "0.1.0" +version = "0.1.1" authors = ["OpenWire contributors"] repository = "https://github.com/peterich-rs/openwire" rust-version = "1.80" @@ -37,14 +37,14 @@ http-body = "1.0.1" http-body-util = "0.1.3" httpdate = "1.0.3" hyper = { version = "1.8.1", features = ["full"] } -openwire = { path = "crates/openwire", version = "0.1.0" } -openwire-cache = { path = "crates/openwire-cache", version = "0.1.0" } -openwire-core = { path = "crates/openwire-core", version = "0.1.0" } -openwire-fastwebsockets = { path = "crates/openwire-fastwebsockets", version = "0.1.0" } -openwire-rustls = { path = "crates/openwire-rustls", version = "0.1.0", default-features = false } +openwire = { path = "crates/openwire", version = "0.1.1" } +openwire-cache = { path = "crates/openwire-cache", version = "0.1.1" } +openwire-core = { path = "crates/openwire-core", version = "0.1.1" } +openwire-fastwebsockets = { path = "crates/openwire-fastwebsockets", version = "0.1.1" } +openwire-rustls = { path = "crates/openwire-rustls", version = "0.1.1", default-features = false } openwire-test = { path = "crates/openwire-test" } -openwire-tokio = { path = "crates/openwire-tokio", version = "0.1.0" } -openwire-tungstenite = { path = "crates/openwire-tungstenite", version = "0.1.0" } +openwire-tokio = { path = "crates/openwire-tokio", version = "0.1.1" } +openwire-tungstenite = { path = "crates/openwire-tungstenite", version = "0.1.1" } pin-project-lite = "0.2.16" rcgen = "0.14.5" rustls = "0.23.35" diff --git a/README.md b/README.md index 596e853..64a462f 100644 --- a/README.md +++ b/README.md @@ -65,15 +65,15 @@ keeps the client API and higher-level policy / planning surfaces. ## Installation -The first planned crates.io release is `0.1.0`: +The next planned crates.io release is `0.1.1`: ```toml [dependencies] -openwire = "0.1.0" +openwire = "0.1.1" ``` Optional companion crates are published with the same workspace version, for -example `openwire-cache = "0.1.0"` or `openwire-tungstenite = "0.1.0"`. +example `openwire-cache = "0.1.1"` or `openwire-tungstenite = "0.1.1"`. Release and versioning steps are documented in `docs/release-process.md`. ## Quick Start diff --git a/docs/release-process.md b/docs/release-process.md index dcf996a..0ab5b4c 100644 --- a/docs/release-process.md +++ b/docs/release-process.md @@ -1,8 +1,8 @@ # Release Process OpenWire publishes the user-facing crates through crates.io so downstream users -can depend on standard registry versions instead of Git source paths. The first -planned release is `0.1.0`. +can depend on standard registry versions instead of Git source paths. The next +planned release is `0.1.1`. ## Published Crates @@ -67,19 +67,24 @@ After the release PR is merged: 1. Create and push a release tag that matches the workspace version: ```sh - git tag v0.1.0 - git push origin v0.1.0 + git tag v0.1.1 + git push origin v0.1.1 ``` -2. Run the `Publish Crates` GitHub Actions workflow on that tag with - `version=0.1.0` and `dry_run=false`. +2. Pushing the `v0.1.1` tag automatically runs the `Publish Crates` GitHub + Actions workflow as a real publish. -The workflow refuses to publish unless it is running on `refs/tags/v`. -It publishes crates in dependency order and waits for each version to become -visible through Cargo before publishing the next dependent crate. +Create the release tag only after the release PR has merged. If the intended tag +already exists on an older commit, delete and recreate it on the release commit +or choose a new version instead. -The same workflow can be run with `dry_run=true` on a branch or tag to execute -the package preflight without requiring a crates.io token. +For tag pushes, the workflow derives the publish version from +`refs/tags/v` and refuses to publish if it does not match the workspace +version. It publishes crates in dependency order and waits for each version to +become visible through Cargo before publishing the next dependent crate. + +The same workflow can still be run manually with `dry_run=true` on a branch or +tag to execute the package preflight without requiring a crates.io token. ## Resuming a Partial Publish @@ -91,7 +96,7 @@ the time reported by crates.io and rerun `Publish Crates` from `main` with: - `dry_run=false` - `start_at` set to the first crate that did not publish -For example, if the first five `0.1.0` crates published and the rate limit +For example, if the first five `0.1.1` crates published and the rate limit stopped at `openwire-fastwebsockets`, rerun with `start_at=openwire-fastwebsockets`. The workflow only allows non-tag publishing when `start_at` is set and the ref is `main`. @@ -101,10 +106,10 @@ when `start_at` is set and the ref is `main`. After the workflow finishes, verify the registry and downstream install path: ```sh -cargo info openwire@0.1.0 +cargo info openwire@0.1.1 tmpdir="$(mktemp -d)" cd "$tmpdir" cargo init --bin -cargo add openwire@0.1.0 +cargo add openwire@0.1.1 cargo check ``` diff --git a/scripts/publish-crates.sh b/scripts/publish-crates.sh index 89fd615..233d315 100755 --- a/scripts/publish-crates.sh +++ b/scripts/publish-crates.sh @@ -96,10 +96,21 @@ else selected_publish_order=("${publish_order[@]}") fi -cargo_args=() -if [[ "$allow_dirty" -eq 1 ]]; then - cargo_args+=(--allow-dirty) -fi +cargo_package() { + if [[ "$allow_dirty" -eq 1 ]]; then + cargo package "$@" --allow-dirty + else + cargo package "$@" + fi +} + +cargo_publish() { + if [[ "$allow_dirty" -eq 1 ]]; then + cargo publish "$@" --allow-dirty + else + cargo publish "$@" + fi +} crate_version() { cargo pkgid -p "$1" | sed 's/.*#//' @@ -165,14 +176,14 @@ fi for crate in "${selected_publish_order[@]}"; do echo "==> ${mode}: ${crate}" if [[ "$mode" == "dry-run" ]]; then - cargo package -p "$crate" --list "${cargo_args[@]}" >/dev/null + cargo_package -p "$crate" --list >/dev/null if [[ "$crate" == "openwire-core" ]]; then - cargo package -p "$crate" --no-verify "${cargo_args[@]}" + cargo_package -p "$crate" --no-verify else echo "checked package file list; tarball packaging waits for staged registry dependencies" fi else - cargo publish -p "$crate" "${cargo_args[@]}" + cargo_publish -p "$crate" if [[ "$wait_for_registry" -eq 1 ]]; then wait_until_visible "$crate" "$workspace_version" fi