Docs

Guide 16

Releases

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.yml for a workflow_dispatch npmjs 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 subjectBump
feat(orm): eager load via query IRminor
fix(next): type page() as Promisepatch
perf, refactor, or any other typepatch
feat(core)!: or a BREAKING CHANGE: footermajor
docs, chore, style, test, ci, buildnone
Anything that is not a conventional subjectpatch

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 docs or chore, 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:

  1. Decides the version, or exits cleanly when no commit earns a bump.
  2. bun run release:bump <version> across all 11 publishable manifests, plus bun install.
  3. Runs bun run check against the bumped tree. Tagging and publishing require a passing run.
  4. Checks that the NPM_TOKEN secret is set. A missing secret stops the run before the tag.
  5. Commits chore(release): <version>, pushes it to main, and pushes the v<version> tag.
  6. Cuts a GitHub Release with generated notes, spanning the previous v* tag to this one.
  7. Publishes to npmjs on the latest dist-tag.
  8. Publishes to GitHub Packages on the latest dist-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 decision
  • dry_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:

  1. npmjs: run publish.yml with dry_run false and tag latest. It publishes whatever version the manifests on main currently hold, which is the version the tag names.
  2. 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.

  1. Sign in at https://www.npmjs.com/login. Create an account if you don't have one.
  2. Open https://www.npmjs.com/org/create.
  3. Name the org avelonjs.
  4. Pick the free plan (unlimited public packages).

Step 2 - Make an Automation Token

  1. Open https://www.npmjs.com/settings/~/tokens.
  2. Generate a granular access token.
  3. Set this and nothing else:
    • Permissions: Read and write
    • Organization: avelonjs
    • Packages: all packages in that org / the @avelonjs scope
    • Expiration: 90 days is fine
    • Two-factor: off / bypass
  4. 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:

  1. GitHub repo → Settings → Secrets and variables → Actions → New repository secret
  2. Name it exactly NPM_TOKEN
  3. 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 seeWhat it meansWhat you do
NPM_TOKEN is not setThe secret is missing or named wrongRepeat step 3. The name is NPM_TOKEN.
403 / no permission for @avelonjsOrg or token scope is wrongConfirm the org is avelonjs and the token can write that scope.
2FA / OTP prompt in the logYou created a token that requires 2FAMake a new token with 2FA bypass. Delete the old one.
cannot publish over existing versionThat version is already on the registryStop. Do not republish. The next merge cuts the next number.
The run says no releasable commitsEvery commit was docs or choreNothing 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:

PackageWhat it is
@avelonjs/coreFrozen contracts, errors, and capability types
@avelonjs/ormModel layer and QueryIR builder
@avelonjs/clireeve CLI and TUI
@avelonjs/nextNext.js adapter
@avelonjs/bailiffArchitecture linter
@avelonjs/assayTest harness
@avelonjs/supabaseSupabase drivers
@avelonjs/postgresPostgres database driver
@avelonjs/neonNeon drivers (database, auth, S3, queue)
@avelonjs/resendResend mail driver
@avelonjs/conformanceContract suites and fakes

These stay private. You don't publish them:

PackageWhy
avelon (repo root)Workspace root
@avelonjs/docs-siteSite builder for this repository
@avelonjs/s4Integration slice
@avelonjs/gazetteExample app under examples/gazette

TypeScript Source Instead of a Compiled dist

The first public line publishes TypeScript source:

  • Package exports point at ./src/index.ts
  • There's no dist/, no dual CJS/ESM build, and no tsc emit 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/core and @avelonjs/orm still must not import bun:*
  • engines.bun is >=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:bump rewrites all 11 manifests together
  • scripts/release/version.ts reads packages/core/package.json as 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:

  1. Copies the root LICENSE into the package if needed.
  2. Runs bun pm pack --destination <temp> --ignore-scripts from the package directory. Bun writes <name>-<version>.tgz. It rejects --filename together with --destination.
  3. Prints every path in the tarball.
  4. Fails if:
    • LICENSE or README.md is missing
    • src/ is missing
    • tests/, fixtures/, tsconfig, or *.test.ts leaked
    • the packed package.json still contains workspace:

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.com with GITHUB_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 next tag without cutting a release
  1. Put an npm automation token in the repository secret NPM_TOKEN. Don't commit it. Don't put it in .npmrc.
  2. Open the Publish workflow in GitHub Actions and run it.
  3. Leave dry_run at true the first time. That only runs bun run release:pack.
  4. When you mean it, set dry_run to false and choose a tag (next, dev, or latest).
  5. The workflow then runs bun scripts/release/publish.ts with:
    • NPM_TOKEN
    • NPM_CONFIG_TOKEN, the same value. publish.ts reads this name first
    • RELEASE_TAG

A real publish also needs:

  • the avelonjs org
  • 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:

  1. Open Publish GitHub Packages.
  2. First click: leave dry_run true. That only packs.
  3. Second click: set dry_run to false. That uploads.
  4. Or push a tag named github-packages-v*, for example github-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

  • .env or .env.*
  • A service role key
  • A real project ref
  • NPM_TOKEN or 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.yml runs bun install --frozen-lockfile and bun run check on pushes and pull requests
  • .github/workflows/release.yml runs 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.