16. Releases
How you pack and publish @avelonjs/* from this monorepo. npmjs is the public install target.
The GitHub repo Packages tab is a different registry. GitHub won't host @avelonjs/* under the yannelli account, so that tab shows @yannelli/* until the repo lives under a GitHub org named avelonjs.
Automatic Releases
Merging to main cuts the release. .github/workflows/release.yml:
- reads the commits
- picks the number
- bumps every publishable manifest
- tags
- cuts the GitHub Release
- uploads to both registries
You don't run release:bump by hand and you don't click a workflow.
The 2 older paths still exist and are still hand-driven:
publish.ymlfor aworkflow_dispatchnpmjs upload- a
github-packages-v*tag for GitHub Packages only
Use them to recover from a release that half-finished. The normal route is a merge.
What Triggers One
A push to main. In practice that's a squash-merged pull request.
How the Number Is Chosen
scripts/release/version.ts reads every commit since the last v* tag and takes the largest bump any one of them earns:
| Commit subject | Bump |
|---|---|
feat(orm): eager load via query IR | minor |
fix(next): type page() as Promise | patch |
perf, refactor, or any other type | patch |
feat(core)!: or a BREAKING CHANGE: footer | major |
docs, chore, style, test, ci, build | none |
| Anything that is not a conventional subject | patch |
That last row is deliberate. A merge that moves nothing is the failure this workflow exists to end. So Fix markdown tables squeezing to unreadable text on mobile docs is treated as a real change, even though nobody typed fix(docs-site):.
- Write conventional subjects and you get the bump you meant
- Put
[skip release]in a commit message to opt that commit out - If every commit in the range is
docsorchore, nothing releases and the run says so in its summary. That isn't a failure
Before 1.0.0 a breaking change moves the minor, not the major. There's no stable public surface to break yet.
What the Run Does
In this order, stopping the whole release if any step fails:
- Decides the version, or exits cleanly when no commit earns a bump.
bun run release:bump <version>across all 11 publishable manifests, plusbun install.- Runs
bun run checkagainst the bumped tree. Tagging and publishing require a passing run. - Checks that the
NPM_TOKENsecret is set. A missing secret stops the run before the tag. - Commits
chore(release): <version>, pushes it tomain, and pushes thev<version>tag. - Cuts a GitHub Release with generated notes, spanning the previous
v*tag to this one. - Publishes to npmjs on the
latestdist-tag. - Publishes to GitHub Packages on the
latestdist-tag.
The bump commit is pushed with GITHUB_TOKEN. GitHub doesn't start workflow runs from those, so the release can't trigger itself.
A concurrency group named release holds the job to 1 at a time. 2 merges in the same minute queue instead of racing for the tag.
Running It by Hand
The workflow is also workflow_dispatch:
version- cut this exact number instead of reading the commits. Leave it empty for the normal decisiondry_run- decide, bump, and verify, then stop. Nothing is tagged, released, or uploaded. Defaults to true, so a click without thinking is safe
Preview the Decision Locally
bun run release:version
That prints:
- the current version
- the tag it's measuring from
- every commit with the bump it earns and why
- the version it would cut
It changes nothing.
When a Release Half-Finishes
npm versions are permanent. If step 7 uploaded and step 8 failed, don't re-run the release to fix it. The tag and the npm version already exist. Do one of these instead:
- publish the missing registry by hand from the tag
- fix forward with the next merge
A run that tags and cuts the Release but uploads nothing leaves a version number that exists in git and on the Releases page, and on no registry.
Step 4 is there to stop that before the tag. A token that's present and then rejected still gets this far.
Recover by publishing the version already on disk, instead of cutting a new one:
- npmjs: run
publish.ymlwithdry_runfalse andtaglatest. It publishes whatever version the manifests onmaincurrently hold, which is the version the tag names. - GitHub Packages: push a
github-packages-v<version>tag.
Don't delete the tag and re-run the release to "redo" it. The next merge cuts the next number and leaves the stranded one behind. Publishing it is what closes the gap.
First Publish (Do These Once)
Do them in order. Copy the commands. Don't invent a second process.
Step 1 - Create the npm Org
The product is Avelon. The npm scope is @avelonjs, because @avelon belongs to someone else.
Skip this step if you already created the avelonjs org.
- Sign in at https://www.npmjs.com/login. Create an account if you don't have one.
- Open https://www.npmjs.com/org/create.
- Name the org
avelonjs. - Pick the free plan (unlimited public packages).
Step 2 - Make an Automation Token
- Open https://www.npmjs.com/settings/~/tokens.
- Generate a granular access token.
- Set this and nothing else:
- Permissions: Read and write
- Organization:
avelonjs - Packages: all packages in that org / the
@avelonjsscope - Expiration: 90 days is fine
- Two-factor: off / bypass
- Copy the token. It starts with
npm_. You won't see it again.
A token that still requires 2FA returns EOTP and never uploads. This is the usual failure. Delete that token and make another.
Step 3 - Put the Token in GitHub
In a terminal, already logged into gh as you:
gh secret set NPM_TOKEN --repo yannelli/avelon
Paste the token when it asks. Press Enter.
Or click through GitHub:
- GitHub repo → Settings → Secrets and variables → Actions → New repository secret
- Name it exactly
NPM_TOKEN - Paste the token
Don't put the token in .env or .npmrc. Don't commit it.
Step 4 - Merge Something
That's the whole step. The next push to main runs release.yml, which bumps every publishable manifest together, tags, and uploads.
release:bump still exists and still rewrites the 11 manifests plus bun.lock. The workflow is what calls it now.
11 packages publish in this order: core, conformance, bailiff, orm, postgres, neon, resend, next, supabase, assay, cli.
Done when you can open https://www.npmjs.com/package/@avelonjs/core and see the version the run cut. Run bun run release:version first if you want to know what number that will be.
If Something Explodes
| What you see | What it means | What you do |
|---|---|---|
NPM_TOKEN is not set | The secret is missing or named wrong | Repeat step 3. The name is NPM_TOKEN. |
403 / no permission for @avelonjs | Org or token scope is wrong | Confirm the org is avelonjs and the token can write that scope. |
| 2FA / OTP prompt in the log | You created a token that requires 2FA | Make a new token with 2FA bypass. Delete the old one. |
cannot publish over existing version | That version is already on the registry | Stop. Do not republish. The next merge cuts the next number. |
| The run says no releasable commits | Every commit was docs or chore | Nothing to publish. Merge a feat or fix, or dispatch with an explicit version. |
What You Publish
These packages are public (private is false) and share one version:
| Package | What it is |
|---|---|
@avelonjs/core | Frozen contracts, errors, and capability types |
@avelonjs/orm | Model layer and QueryIR builder |
@avelonjs/cli | reeve CLI and TUI |
@avelonjs/next | Next.js adapter |
@avelonjs/bailiff | Architecture linter |
@avelonjs/assay | Test harness |
@avelonjs/supabase | Supabase drivers |
@avelonjs/postgres | Postgres database driver |
@avelonjs/neon | Neon drivers (database, auth, S3, queue) |
@avelonjs/resend | Resend mail driver |
@avelonjs/conformance | Contract suites and fakes |
These stay private. You don't publish them:
| Package | Why |
|---|---|
avelon (repo root) | Workspace root |
@avelonjs/docs-site | Site builder for this repository |
@avelonjs/s4 | Integration slice |
@avelonjs/gazette | Example app under examples/gazette |
TypeScript Source Instead of a Compiled dist
The first public line publishes TypeScript source:
- Package
exportspoint at./src/index.ts - There's no
dist/, no dual CJS/ESM build, and notscemit step
That's intentional for this prep. It isn't a stand-in for a later compiled release.
You consume these packages with Bun, which runs TypeScript directly:
@avelonjs/coreand@avelonjs/ormstill must not importbun:*engines.bunis>=1.3.14, because that's the toolchain this repo pins (docs/11-runtime.md)
A compiled dist is a later change. Don't advertise Node-native install until that lands.
Version Policy
Every publishable package shares one version. You don't ship @avelonjs/orm@0.2.0 against @avelonjs/core@0.1.0.
release:bumprewrites all 11 manifests togetherscripts/release/version.tsreadspackages/core/package.jsonas the one number for the set
After versions change, bun install has to run so bun.lock matches the on-disk manifests. bun run release:bump <version> does both the rewrite and the install.
Bun 1.3.14 rewrites workspace:* from the workspace package versions it can see. A stale lockfile is how you publish the wrong number.
Before 1.0.0, a breaking change moves the minor. 0.1.0 was cut by hand and published to GitHub Packages only. That's why the first automatic release is 0.2.0 instead of a patch on top of it.
An automatic release always uploads on the latest dist-tag. Use publish.yml with an explicit tag when you want a canary on next or dev without moving latest.
License
The repo root LICENSE is MIT, copyright Ryan Yannelli. For the tarball, the pack and publish scripts:
- copy that file into each publishable package directory
- remove the copy afterward if it wasn't already checked in
You don't maintain 11 LICENSE files by hand.
Dry-Run Pack
From the repo root:
bun run release:pack
That runs scripts/release/pack.ts. For each publishable package it:
- Copies the root
LICENSEinto the package if needed. - Runs
bun pm pack --destination <temp> --ignore-scriptsfrom the package directory. Bun writes<name>-<version>.tgz. It rejects--filenametogether with--destination. - Prints every path in the tarball.
- Fails if:
LICENSEorREADME.mdis missingsrc/is missingtests/,fixtures/,tsconfig, or*.test.tsleaked- the packed
package.jsonstill containsworkspace:
The CLI tarball also includes the reeve new template. The pack check:
- requires its manifest, routes, and
.gitignore - permits app test stubs under
templates/app/tests/
You don't need NPM_TOKEN for this. CI runs the same command.
Workspace Protocol
Workspace packages depend on each other with workspace:*. That protocol is invalid on npm.
bun pm pack --destination <dir> --ignore-scripts writes the exact dependency version into the tarball. The source package.json keeps its workspace:* references.
Both release scripts validate the packed files and reject a manifest that still contains workspace:.
scripts/release/publish.ts:
- packs and validates all packages before uploading
- uploads the tarballs in dependency order with
npm publish <tarball> - reads npm credentials from a temporary
.npmrc
Publishing from the workspace directory with npm skips Bun's rewrite. That's what broke standalone installs from npm 0.8.6. The corrected publisher shipped in 0.8.7.
With RELEASE_REGISTRY=github, the publisher:
- rewrites the packed manifests, TypeScript, and README references to the
@<github-owner>/*scope - uploads the archives to
https://npm.pkg.github.comwithGITHUB_TOKEN
bun publish in 1.3.14 still opens npm's web OTP flow even with NPM_CONFIG_TOKEN. Don't use it for the first public line.
RELEASE_TAG defaults to next.
Publish Through workflow_dispatch
.github/workflows/publish.yml is workflow_dispatch only and doesn't run on push. It's the manual fallback. The normal path is release.yml, above, which runs on every merge to main.
Reach for this one to:
- re-upload to npmjs after a release that half-finished
- put a canary on the
nexttag without cutting a release
- Put an npm automation token in the repository secret
NPM_TOKEN. Don't commit it. Don't put it in.npmrc. - Open the Publish workflow in GitHub Actions and run it.
- Leave
dry_runattruethe first time. That only runsbun run release:pack. - When you mean it, set
dry_runtofalseand choose a tag (next,dev, orlatest). - The workflow then runs
bun scripts/release/publish.tswith:NPM_TOKENNPM_CONFIG_TOKEN, the same value.publish.tsreads this name firstRELEASE_TAG
A real publish also needs:
- the
avelonjsorg - a token that can write
@avelonjs/*without 2FA
The script refuses to run when neither NPM_CONFIG_TOKEN nor NPM_TOKEN is set.
Publish order is core, conformance, bailiff, orm, postgres, neon, resend, next, supabase, assay, cli.
GitHub Packages
This fills the Packages tab on the GitHub repo. It isn't a substitute for npmjs. Install from npmjs unless you're testing the GitHub registry on purpose.
GitHub Packages only accepts scoped names whose scope matches the GitHub owner. This repo is yannelli/avelon, so:
- the uploaded names are
@yannelli/core,@yannelli/orm, and the rest of the publishable set - on-disk manifests stay
@avelonjs/* - the publish script rewrites the packed tarball after
workspace:*has already become a version number
No extra secret. .github/workflows/publish-github-packages.yml uses GITHUB_TOKEN with packages:write.
To publish:
- Open Publish GitHub Packages.
- First click: leave
dry_runtrue. That only packs. - Second click: set
dry_runto false. That uploads. - Or push a tag named
github-packages-v*, for examplegithub-packages-v0.1.0. A tag skips the dry run and publishes.
Done when you can open https://github.com/yannelli/avelon/pkgs and see the 11 packages.
To install from that registry instead of npmjs:
@yannelli:registry=https://npm.pkg.github.com
When this repository is transferred to a GitHub org named avelonjs, the rewrite becomes a no-op and the Packages tab shows @avelonjs/*.
What You Never Commit
.envor.env.*- A service role key
- A real project ref
NPM_TOKENor any other registry credential
.gitignore already drops .env. The publish workflow reads NPM_TOKEN from GitHub Actions secrets and only injects it when dry_run is false.
Provenance
bun publish in Bun 1.3.14 has no --provenance flag. This prep doesn't claim npm provenance.
If you later publish with npm publish --provenance, add id-token: write to the workflow and document that change here.
CI
.github/workflows/ci.ymlrunsbun install --frozen-lockfileandbun run checkon pushes and pull requests.github/workflows/release.ymlruns the same checks on the bumped tree before tagging or publishing
bun run test:unit excludes *.live.test.ts. Run the specific live suite for your driver with the services described in the driver authoring guide.