A release publishes the SDKs: the Rust crates to
crates.io and the TypeScript SDK to
npm. It then tags the commit,
creates its GitHub release and closes its milestone. A maintainer runs it from
their machine with just release.
SourceOrigin follows semantic versioning. Before 1.0:
- a minor release, such as 0.2.0, may change the SDKs' API in ways that break existing apps. Its release notes say how to upgrade.
- a patch release, such as 0.1.1, never breaks the API: upgrading to it needs no changes.
1.0 comes once the claim and challenge types have settled.
The Rust crates share the workspace version, version under
[workspace.package] in the root Cargo.toml, and are released together. Each
published crate requires the others at exactly that version, so an app never
mixes them. Each release is tagged v<version> with the workspace version, such
as v0.2.0, on a commit of main.
@sourceorigin/auth has its own version, version in packages/auth/package.json.
A release publishes it only when that version isn't on npm yet, so a release
that changes only the Rust crates leaves it alone.
The published crates build with Rust 1.88 or newer: rust-version under
[workspace.package], which the msrv CI job checks. The npm package needs
Node 22 or newer, its engines. Raising either is a change users notice, so the
release notes say so.
| Package | Registry | Source |
|---|---|---|
sourceorigin-common |
crates.io | crates/common: identifiers and the wire types of auth's protocol |
sourceorigin-crypto |
crates.io | crates/crypto: the cryptography auth and the Rust SDK share |
sourceorigin-auth |
crates.io | crates/auth-sdk: the Rust SDK |
@sourceorigin/auth |
npm | packages/auth: the TypeScript SDK |
These are under the Apache License 2.0,
which each carries: the crates through a link to the root's LICENSE-APACHE,
which Cargo packages as a file, and the npm package as a copy, since npm skips
links. Every other crate is under the PolyForm Noncommercial License and sets
publish = false, so it can't be published, nor become a dependency of a crate
that is. just publish refuses to publish a crate under any other license.
sourceorigin-common is published whole: its server-only features, such as
sqlx and events, are off by default, so an app builds none of them.
docs.rs builds each crate's documentation with every feature, and labels the
items a feature adds. sourceorigin-auth's front page holds a quick start, its
notes example.
just publish, which runs cargo xtask publish
(tools/xtask),
publishes the crates with cargo publish --workspace, which publishes them in
dependency order and builds each from its package, as an app would. It then
publishes the npm package with npm publish, whose prepack script builds it.
It skips a crate or package whose version is published already.
The package CI job runs just publish --dry-run on every pull request that
changes them: it packages each crate and builds it from its package, and packs
the npm package, without uploading anything. Run it yourself after changing a
manifest, package.json, or a file a crate reads at compile time:
just publish --dry-run --allow-dirtyDo this once, on the machine you release from:
-
On crates.io, sign in with GitHub, open Account Settings, then API Tokens, and create a token with the
publish-newandpublish-updatescopes, limited to the cratessourceorigin-*. Save it for Cargo:cargo login -
On npm, create the
sourceoriginorganization if it doesn't exist, so the@sourceoriginscope is yours, and make sure your account is a member. Then sign in:npm login -
Sign the GitHub CLI in to the repository with
gh auth login, and install the Cargo tools,cargo-semver-checksamong them, withjust install-tools.
You also need what getting started installs: the Rust
toolchain of rust-toolchain.toml, Node and pnpm.
-
Open a pull request that sets the new versions:
- in the root
Cargo.toml,versionunder[workspace.package], and theversionof every local crate under[workspace.dependencies], keeping the=ofsourceorigin-commonandsourceorigin-crypto. Then runcargo update --workspaceto updateCargo.lock. - in
packages/auth/package.json,version, when the TypeScript SDK changed.
- in the root
-
Merge it, and check out the merge commit:
git switch main && git pullThe merge queue tested this exact commit before merging it.
-
Check the release without changing anything:
just release --dry-runIt runs every check of the next step, and packages and builds the SDKs without uploading them. It then prints the commands the other steps would run, and writes the release notes to
target/release-notes-v<version>.md. -
Release it:
just releaseIt checks that you are on the latest
mainwith a clean working tree, and that the version isn't released yet. It runscargo semver-checksagainst the previous release: an API change that breaks it fails here, unless the new version allows it, which before 1.0 only a minor release does. It then:- publishes the crates, which takes several minutes, then the npm package. npm may ask for a one-time password.
- tags the commit
v<version>and pushes the tag. - creates the GitHub release, titled
SourceOrigin <version>. - closes the GitHub milestone of the minor version, such as
v0.2for 0.2.0. A patch release finds it closed already.
-
For a release that breaks existing apps, edit its GitHub release to say how to upgrade.
The release notes list what was published, the npm package only when its
version changed since the previous release, then the pull requests merged since
the previous release, from the titles of their squashed commits on main:
breaking changes (a ! after the type, as in feat(sdk)!:), features (feat),
fixes (fix), and the rest. A title's scope leads its line, in bold.
The packages' pages on crates.io and npm list the new versions. Add them to a new project:
cargo new release-check && cd release-check
cargo add sourceorigin-auth --features axum
cargo build
npm install @sourceorigin/authdocs.rs builds the crates' documentation within a few minutes. The GitHub
release lists the merged pull requests, and the v<major>.<minor> milestone is
closed.
cargo semver-checksfinds a breaking change. Either undo it, or release a new minor version instead: change the versions in a new pull request, and start again.- Publishing fails partway. What was published stays published, and the tag
isn't pushed yet. Fix the cause, such as an expired token, and run
just releaseagain: it skips what is published already. - Tagging fails. Everything is published. If the tag was created but not
pushed, remove it with
git tag --delete v<version>. Then runjust releaseagain. - Creating the GitHub release fails. The tag is pushed, so
just releaserefuses to run again. Run thegh release createcommand it printed, then close thev<major>.<minor>milestone on GitHub. - Closing the milestone fails. Close it on GitHub.
- A published version is broken. A version can't be replaced. Yank each
crate with
cargo yank --version <version> <crate>, deprecate the npm version withnpm deprecate @sourceorigin/auth@<version> "<why>", and release a fixed patch version.