Skip to content
Merged
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: 47 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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<version>; 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<semver>; 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
Expand All @@ -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"
Expand All @@ -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"
Expand Down
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 19 additions & 14 deletions docs/release-process.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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<version>`.
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<version>` 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

Expand All @@ -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`.
Expand All @@ -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
```
25 changes: 18 additions & 7 deletions scripts/publish-crates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/.*#//'
Expand Down Expand Up @@ -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
Expand Down
Loading