Repository navigation
Commit 3d7bf8c
authored
build(sdk): publish the SDKs to crates.io and npm with
Nothing in the repository was published, so an app outside it had to
depend on `sourceorigin-auth` by git and build `@sourceorigin/auth` from
a checkout, and the developer console's Rust snippet said so. Now `just
release` publishes the SDKs from the maintainer's machine, the same way
piqueld releases: no publishing workflow, no trusted publishing and no
`release` environment.
`just release` runs `cargo xtask release` (new, `tools/xtask`, shaped
like piqueld's):
1. Checks that HEAD is the latest `origin/main` and that `v<version>`
isn't tagged yet. From the second release on, it also runs `cargo
semver-checks` against the previous `v*` tag, so a breaking change needs
a version that allows it.
2. Publishes `sourceorigin-common`, `sourceorigin-crypto` and
`sourceorigin-auth` with `cargo publish --workspace`, then
`@sourceorigin/auth` with `npm publish` at its own version. Versions
already on a registry are skipped, so a release that fails partway can
simply be run again.
3. Tags `v<version>` and pushes the tag.
4. Creates the GitHub release with `gh release create`. Its notes list
the published packages, then the PRs merged since the previous tag,
grouped by title type: breaking changes, features, fixes, and everything
else (#463).
5. Closes the `v<major>.<minor>` milestone.
`just release --dry-run` runs the checks, `cargo publish --dry-run` and
`npm publish --dry-run`, writes the notes to
`target/release-notes-v<version>.md`, and prints the other steps as
commands you can paste. `just publish` runs only step 2. A new `package`
CI job runs `just publish --dry-run` on PRs that touch Rust or web
files, and a new `msrv` job builds the published crates with Rust 1.88.
I ran both dry runs locally. The release one ran with its `origin/main`
check stubbed out, since this branch isn't `main`. All three crates
packaged and built from their packages, and the notes came out grouped
as intended.
Other changes:
- **`sourceorigin-crypto` is published too.** The SDK depends on it
since #495, and #500 relicensed it Apache-2.0. Every other crate, and
`xtask`, sets `publish = false`. `just publish` also refuses to publish
any crate not under Apache-2.0.
- **Versions.** The three crates share the workspace version and require
each other at exactly that version (`=0.1.0` in
`[workspace.dependencies]`). The SDK vector generator moved from
`sourceorigin-common`'s tests to `sourceorigin-crypto`'s: it was
common's only use of crypto, a test-only dependency back on a crate that
depends on common, which would have kept common from publishing first.
The vectors are unchanged, and `just sdk-vectors` now runs `-p
sourceorigin-crypto`.
- **Package metadata.** `rust-version = "1.88"`, the oldest toolchain
installed here that builds them. Also READMEs, `LICENSE-APACHE` (a
symlink, which Cargo packages as a file), keywords, categories, and
docs.rs `all-features` with `doc_cfg` labels.
- **The `sourceorigin-auth` crate docs** now open with a quick start
that shows `examples/notes.rs`.
- **npm.** `@sourceorigin/auth` is no longer private:
`publishConfig.access = public`, a `prepack` build, and a `LICENSE` copy
(npm skips symlinks).
- **Developer console.** The Rust snippet depends on `version = "<the
workspace version>"` instead of git. The console links docs.rs and npm,
and names both SDKs on the home page and on a confidential app's page.
- **Docs.** New `docs/dev/releasing.md`. Updated the install steps in
the user guide, the agent skill and the READMEs, plus the architecture
overview, the SDK design page, testing (recipes and CI jobs) and
AGENTS.md.
- **Changelogs.** The GitHub release notes are the changelog, and every
package README links to them. There are no `CHANGELOG.md` files, since
nothing would generate them without a release tool.
## Your checklist
Do these once, in this order. Nothing here was published or registered
by me.
1. **crates.io token.** Sign in at https://crates.io with GitHub, then
go to **Account Settings** → **API Tokens** → **New Token**. Name it
`sourceorigin release`, give it the scopes `publish-new` and
`publish-update`, and limit it to the crates `sourceorigin-*`. Then save
it for Cargo:
```sh
cargo login
```
2. **npm scope.** Create the `sourceorigin` organization (free, public
packages) at https://www.npmjs.com/org/create, so `@sourceorigin` is
yours. Then sign in and check:
```sh
npm login
npm whoami
```
3. **Tools.**
```sh
gh auth status
just install-tools # adds cargo-semver-checks
```
4. **Release 0.1.0**, once this PR and #506 are merged and the merge
commit's CI has passed:
```sh
git switch main && git pull
just release --dry-run
just release
```
npm may ask for a one-time password while publishing. The first `just
release` publishes `0.1.0` of all three crates and the npm package,
which claims the names. Checked today, `sourceorigin-common`,
`sourceorigin-crypto`, `sourceorigin-auth` and `@sourceorigin/auth` are
all still free. Then check the result, as `docs/dev/releasing.md`
describes:
```sh
cargo new /tmp/release-check && cd /tmp/release-check
cargo add sourceorigin-auth --features axum && cargo build
npm install @sourceorigin/auth
```
Closes #61
Proved by: `just publish --dry-run` (all three crates packaged and built
from their packages, npm packed), `just release --dry-run` with only the
`origin/main` check stubbed, both before the first release and against a
fake earlier `v0.0.9` tag (semver-checks ran against it, notes covered
only later commits and left out the unchanged npm package), and the
Docker planner stage built locally.
Reviewed with review-loop: 2 rounds with 2× GPT 6.1 Sol and Claude Opus
5.5. Verdict: approved
> [!NOTE]
> Written by Claude Opus 5.5 in Claude Code and reviewed by GPT 6.1 Sol
and Claude Opus 5.5 (via T3 Code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Overview
This change prepares the Rust and TypeScript SDKs for publication. It
adds a maintainer-run release tool (`cargo xtask`), publish and release
recipes, CI dry-run jobs, package metadata, and documentation. It does
not publish anything yet. The diff changes 48 files, with 1,445 lines
added and 76 removed.
## Release tooling (`tools/xtask`)
- `tools/xtask/src/main.rs` adds the `cargo xtask` entry point with
`publish` and `release` subcommands. It also adds `Workspace`, which:
- Reads the Git checkout root and Cargo metadata.
- Selects crates whose `publish` setting is absent or non-empty.
- Errors if no crate is publishable or if selected crates have different
versions.
- Reads the npm package name and version from
`packages/auth/package.json`.
- Runs Cargo subprocesses from the workspace root with Cargo package
environment variables removed.
- `tools/xtask/src/publish.rs` adds `Publish`. It:
- Checks that each published crate uses the exact `Apache-2.0` license.
- Unless `allow_dirty` is set, rejects a dirty working tree.
- Runs `cargo publish --locked --workspace`, skipping versions already
on crates.io.
- Publishes the npm package unless that version already exists.
- In dry-run mode, skips registry checks and passes `--dry-run` to Cargo
and npm.
- Treats a registry lookup as "not found" only when stderr contains the
expected marker. Other failures return errors.
- `tools/xtask/src/release.rs` adds `Release`. It:
- Finds the latest `v*` tag reachable from `HEAD`.
- Requires `HEAD` to match fetched `origin/main`.
- Rejects a version already tagged on origin.
- Runs `cargo semver-checks` against the previous tag for published
packages. Without a previous tag, it skips this check.
- Runs the publish step.
- Writes release notes that list published crates and the npm package.
Notes also list first-parent commit subjects grouped by Conventional
Commits type.
- Creates and pushes an annotated version tag, creates a GitHub release,
and closes the matching `v<major>.<minor>` milestone if it is open.
- In dry-run mode, prints commands instead of running them.
- Includes tests for grouping and formatting.
- `tools/xtask/Cargo.toml` adds the package. Publishing is disabled and
workspace lints are enabled.
- `.cargo/config.toml` adds the `xtask` alias.
## Task runner and workflow
- `justfile`:
- Adds `cargo-semver-checks` to `install-tools`.
- Adds `publish *ARGS` and `release *ARGS` recipes that forward
arguments to `cargo xtask`.
- Changes `sdk-vectors` to run the `sourceorigin-crypto` integration
test instead of the `sourceorigin-common` test.
- `.github/workflows/ci.yml`:
- Adds `tools/**` to the Rust path filter.
- Adds a `package` job that runs `just publish --dry-run` when Rust or
web files change.
- Adds an `msrv` job that installs the Rust version from the root
`Cargo.toml` and checks the listed crates when Rust files change.
- Adds both jobs to the `ci` job's dependencies and allowed-skipped
list.
- `deny.toml` adds a license exception for
`PolyForm-Noncommercial-1.0.0` for the `xtask` crate.
## Workspace and crate metadata
- `Cargo.toml`:
- Adds `tools/xtask` as a workspace member.
- Sets the homepage to `https://sourceorigin.dev`.
- Sets the workspace MSRV to `1.88`.
- Pins the `sourceorigin-common` and `sourceorigin-crypto` workspace
dependencies to exactly `0.1.0`. Other local dependencies keep non-exact
`0.1.0` requirements.
- Documents that non-SDK crates are unpublished and that the published
crates are released together.
- `crates/auth-sdk` (`sourceorigin-auth`):
- Adds homepage, `rust-version`, README path, keywords, categories, and
docs.rs settings that build all features and pass `--cfg docsrs`.
- Adds `LICENSE-APACHE` as a symbolic link to the root license.
- Rewrites the README with an Axum sign-in example, token validation
notes, and links.
- Adds a Quick start section and a `docsrs`-conditional `doc_cfg`
attribute to the crate docs.
- `crates/common` (`sourceorigin-common`):
- Inherits homepage and `rust-version`, adds README, keywords, and
categories, and adds docs.rs settings.
- Removes `sourceorigin-crypto` and `aws-lc-rs` from dev-dependencies.
- Adds `LICENSE-APACHE` as a symbolic link and adds a README.
- Enables `doc_cfg` under docs.rs.
- `crates/crypto` (`sourceorigin-crypto`):
- Adds the same metadata and docs.rs settings, plus README and
`LICENSE-APACHE`.
- Adds a crate-level `docsrs` `doc_cfg` attribute.
- Its README describes the primitives, the `aws-lc-rs` dependency, the C
compiler requirement, and the MSRV.
- Its manifest does not set `publish = false`. The crate is part of the
published set.
- Private crates get `publish = false` and a PolyForm Noncommercial
License note in their manifests:
- `apps/auth-service`
- `apps/web`
- `crates/database`
- `crates/telemetry`
- `crates/ui`
## Developer console and web app
- `crates/ui/src/developers.rs`:
- The Rust SDK link points to docs.rs.
- The example dependency uses `CARGO_PKG_VERSION` instead of a Git URL.
- Adds a TypeScript SDK link and documents server use for Node, Bun, and
Workers.
- `apps/web/src/pages.rs` changes the homepage SDK feature text to name
`sourceorigin-auth` and `@sourceorigin/auth`.
## npm package (`packages/auth`)
- `package.json`:
- Removes `"private": true` and sets public publish access.
- Adds keywords and a documentation homepage.
- Adds a `prepack` script that runs `tsc`.
- Adds `LICENSE` (Apache License 2.0) and updates `README.md` to use
`npm install @sourceorigin/auth`, add a release-changes link, and add a
License section.
## Documentation
- `docs/dev/releasing.md` (new): documents versioning, publish
prerequisites, release steps, post-release checks, troubleshooting,
dry-run commands, and recovery steps. It states that Rust crates share a
workspace version and the npm package versions independently.
- `docs/SUMMARY.md` links the new release guide.
- `docs/dev/architecture/overview.md` and `docs/dev/architecture/sdk.md`
describe which packages are published and add a Releases section.
- `docs/dev/testing.md` adds the `just publish --dry-run --allow-dirty`
recipe and the `package` and `msrv` CI jobs.
- `docs/dev/contributing.md`, `docs/dev/extending/sdk-feature.md`, and
`tests/sdk-vectors/README.md` point the SDK vector generator to
`crates/crypto/tests/sdk_vectors.rs`.
- `AGENTS.md` and `README.md` describe `tools/xtask`, `just publish`,
`just release`, and the published packages.
- User docs (`docs/user/...`) replace checkout-based install steps with
`cargo add` and `npm install` commands. They also state the Rust 1.88
minimum and the C compiler requirement.
## Points to note
- The raw summary does not describe the `allow-wildcard-paths` setting.
The PR description and commit messages disagree about whether
`cargo-deny` needs it. This summary does not resolve that conflict.
- The PR description says the local release dry run stubbed the
`origin/main` check. The code summary states that `Release` requires
`HEAD` to match `origin/main`. The stub is not visible in this summary.
- The PR description reports local dry runs, which the author ran. CI
results and test results are not available in the supplied evidence.
- The linked issue (`#61`) proposes a GitHub Actions release workflow
with trusted publishing and a `release` environment. This change does
not add that workflow. It adds a maintainer-run `just release` flow
instead. The issue's workflow-based acceptance criteria are not met by
this change.
- The linked issue lists `sourceorigin-crypto` as private. This change
publishes it. This difference is intentional according to the PR
objectives.
- Nothing is published yet. The first release is a manual maintainer
action.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->just release (#513)1 parent 6fb8c8a commit 3d7bf8c
49 files changed
Lines changed: 1474 additions & 76 deletions
File tree
- .cargo
- .github/workflows
- apps
- auth-service
- web
- src
- crates
- auth-sdk
- src
- common
- src
- crypto
- src
- tests
- database
- telemetry
- ui
- src
- docs
- dev
- architecture
- extending
- user
- agents/skills/sourceorigin-sign-in
- apps
- infra
- packages/auth
- tests/sdk-vectors
- tools/xtask
- src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| |||
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
90 | | - | |
| 93 | + | |
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
| |||
180 | 183 | | |
181 | 184 | | |
182 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
183 | 225 | | |
184 | 226 | | |
185 | 227 | | |
| |||
397 | 439 | | |
398 | 440 | | |
399 | 441 | | |
| 442 | + | |
| 443 | + | |
400 | 444 | | |
401 | 445 | | |
402 | 446 | | |
| |||
406 | 450 | | |
407 | 451 | | |
408 | 452 | | |
409 | | - | |
| 453 | + | |
410 | 454 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | | - | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
20 | 26 | | |
21 | 27 | | |
22 | 28 | | |
| |||
42 | 48 | | |
43 | 49 | | |
44 | 50 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
52 | 59 | | |
53 | 60 | | |
| 61 | + | |
54 | 62 | | |
55 | 63 | | |
56 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
16 | 20 | | |
17 | 21 | | |
18 | 22 | | |
| |||
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| 46 | + | |
42 | 47 | | |
43 | 48 | | |
44 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
8 | 13 | | |
9 | 14 | | |
10 | 15 | | |
| |||
37 | 42 | | |
38 | 43 | | |
39 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
40 | 50 | | |
41 | 51 | | |
0 commit comments