Skip to content

Commit 404efe2

Browse files
committed
chore(release): bump to 0.1.3 and add a guarded release command
Bumps the seven version locations publish.yml pins against the tag: the Cargo workspace (both crates inherit it), the npm package, the native and wasm addon manifests, and the node binding plus its smoke package. The captured 0.1.2 attestation fixtures in verify-npm-provenance.test.mjs are historical data and stay put. `pnpm release` tags the current commit and pushes it, which is the only supported upload path: the workflow re-verifies the tag SHA, packs and installs both artifacts, then publishes to crates.io over OIDC and to npm with provenance. Publishing by hand would produce a registry entry with different integrity and no attestation. Every guard mirrors a check the workflow makes once the tag exists, so a mismatch costs nothing instead of burning a tag: on main, clean tree, HEAD identical to origin/main, all seven versions agreeing, and no such tag locally or on origin. Verified at 0.1.3: 238 Rust tests, clippy, fmt, cargo-deny, 5,679 conformance tests, coherent native and WASM artifacts, and both tiers loaded from a packed tarball installed into an isolated prefix.
1 parent 8641c71 commit 404efe2

10 files changed

Lines changed: 67 additions & 10 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ members = ["crates/*"]
55
[workspace.package]
66
edition = "2024"
77
rust-version = "1.88"
8-
version = "0.1.2"
8+
version = "0.1.3"
99
license = "MIT"
1010

1111
[workspace.lints.rust]

crates/zodrs-node/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/zodrs-node/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zod-rs-node",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"private": true,
55
"napi": {
66
"binaryName": "zodrs_node",

crates/zodrs-node/smoke/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zodrs-node-smoke",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"napi": {
55
"binaryName": "zodrs_node",
66
"targets": ["x86_64-unknown-linux-gnu"]

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"engines": {
77
"node": ">=20.17"
88
},
9+
"scripts": {
10+
"release": "bash scripts/release.sh"
11+
},
912
"devDependencies": {
1013
"@napi-rs/cli": "3.8.6",
1114
"@emnapi/core": "1.11.3",

packages/zodrs/native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"name": "zod-rs-node",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"private": true
55
}

packages/zodrs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zodrs",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "TypeScript-first schema validation with static type inference, backed by a Rust core. Drop-in replacement for zod v4.",
55
"repository": {
66
"type": "git",

packages/zodrs/wasm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zod-rs-node-wasm32-wasi",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"private": true,
55
"dependencies": {
66
"@emnapi/core": "1.11.3",

scripts/release.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env bash
2+
# Tag the current commit and push the tag. Pushing a `v*` tag is the only
3+
# supported upload path: `.github/workflows/publish.yml` re-verifies the tag
4+
# SHA, packs, installs and checks both release artifacts, then publishes to
5+
# crates.io over OIDC and to npm with provenance.
6+
#
7+
# Every check here mirrors one the workflow makes after the tag exists. A tag
8+
# is effectively single-use for a release, so failing locally is free and
9+
# failing in CI is not.
10+
set -euo pipefail
11+
12+
die() {
13+
printf 'release: %s\n' "$1" >&2
14+
exit 1
15+
}
16+
17+
branch=$(git branch --show-current)
18+
[ "$branch" = "main" ] || die "releases run from main, not '$branch'"
19+
[ -z "$(git status --porcelain)" ] || die "working tree is not clean"
20+
21+
git fetch --quiet origin main
22+
head=$(git rev-parse HEAD)
23+
remote=$(git rev-parse origin/main)
24+
[ "$head" = "$remote" ] ||
25+
die "HEAD ($head) and origin/main ($remote) differ; push or pull first"
26+
27+
# publish.yml pins the tag against all seven of these.
28+
version=$(node -p "require('./packages/zodrs/package.json').version")
29+
for pair in \
30+
"packages/zodrs/native/package.json:native addon" \
31+
"packages/zodrs/wasm/package.json:wasm addon" \
32+
"crates/zodrs-node/package.json:node binding" \
33+
"crates/zodrs-node/smoke/package.json:node smoke"; do
34+
manifest=${pair%%:*}
35+
found=$(node -p "require('./$manifest').version")
36+
[ "$found" = "$version" ] || die "${pair#*:} is $found, expected $version"
37+
done
38+
workspace=$(python3 -c 'import tomllib; print(tomllib.load(open("Cargo.toml","rb"))["workspace"]["package"]["version"])')
39+
[ "$workspace" = "$version" ] || die "Cargo workspace is $workspace, expected $version"
40+
crate=$(cargo metadata --format-version 1 --no-deps |
41+
jq -r '.packages[] | select(.name == "zodrs") | .version')
42+
[ "$crate" = "$version" ] || die "zodrs crate is $crate, expected $version"
43+
44+
tag="v$version"
45+
if git rev-parse --verify --quiet "refs/tags/$tag" >/dev/null; then
46+
die "$tag already exists locally"
47+
fi
48+
if [ -n "$(git ls-remote --tags origin "refs/tags/$tag")" ]; then
49+
die "$tag already exists on origin"
50+
fi
51+
52+
git tag -a "$tag" -m "$tag"
53+
git push origin "$tag"
54+
printf 'release: pushed %s at %s; publish.yml now verifies and uploads\n' "$tag" "$head"

0 commit comments

Comments
 (0)