How oaktree-sapling is released
A paper’s CI runs oak from a checkout of the engine repository at the version the paper pins, and installs nothing. The steps for making a release are in RELEASING.md.
Why commit the build with a tag¶
ci/run.sh runs node "$engine/dist/cli.cjs", so the build has to be in the checkout before a paper can run it. The release script commits dist/cli.cjs and bin/typst to a new commit off HEAD and tags that commit. It then makes a GitHub release on the tag, which releases/latest and oak upgrade read. Both are gitignored, so no branch carries them. A paper that pins a branch stops at the engine action’s ref step, with an error telling it to pin a release tag, and ci/run.sh refuses a checkout without dist/cli.cjs.
Committing the build at the tag gives three things. Starting oak in a paper’s CI takes one git checkout and no install. Local runs and CI read the same committed file, so they match by git object rather than by esbuild being reproducible. And the Zenodo deposit’s engine.zip, a git archive of that checkout, carries typst, so a deposited PDF can be rendered again with nothing fetched.
The cost is that a branch cannot run in CI: every ref a paper can run is one a release made[1].
These were considered and rejected:
Publishing to npm and installing it in CI. An npm version cannot be deleted after 72 hours, so every dev release made to test CI would stay published, and neither typst nor
engine.zipworks from a package (see The npm package).Committing the build to
mainon every commit puts a build artifact in the history people read.Having CI commit the build back forces a
git pullafter every push.Force-pushed
*-builtrefs are standing machinery for a rare need.Release assets downloaded after checkout are a second download on every run, and they are outside the git tree, so
git archiveleaves them out ofengine.zip.Git LFS adds a dependency to every consumer.
What is committed with the build¶
A deposited PDF is rendered again with oak from engine.zip (below), so everything oak needs for it has to be in git at the tag. The PDF template already is, under templates/typst. Typst is a binary from its own GitHub releases, so the release script commits it as bin/typst. The web theme is downloaded at build time, because a deposit carries the PDF and not the website.
The release script downloads typst at the version in typst.version and runs the tests with it, so the binary that ships is the one the tests used. Bumping typst means editing typst.version and making a release, and it reaches a paper through the same version pin as any other change to oak.
bin/typst is built for linux x86_64 (musl) only, which is what CI uses: every workflow in this repository and in the paper templates runs on ubuntu-latest. So a deposited PDF renders again with nothing fetched on that platform only. On macOS or arm64 the PDF export uses the system typst[2].
What a deposit contains¶
A deposit contains the PDF and what it was rendered from. To render the PDF again with nothing fetched from GitHub, unzip engine.zip, journal.zip and source.zip into three folders, and from the paper’s folder run:
node <engine>/dist/cli.cjs build --journal <journal> --exports-onlyWhen the deposit has a template.zip, unzip it too and add --typst-template <template>. --exports-only builds the PDF without the website, whose theme is downloaded. For a paper that is its own journal[3], leave out --journal: oak finds journal.yml beside the paper.
| file | holds |
|---|---|
paper.pdf | the PDF |
source.zip | the paper repository at the tagged commit |
myst.yml | the paper’s own config |
myst.oak.yml | the config the build assembled, kept as a record: its paths are the build machine’s |
engine.zip | oak at the version the paper pins, with typst and oak’s PDF template |
journal.zip | the journal repository at the commit the build used |
template.zip | the PDF template, when it is the journal’s or the author’s |
publication-provenance.json | the paper’s and the journal’s repository and commit, the paper’s website, the DOIs, and where, when and with which typst the PDF was built |
The files in the paper’s deposit/ folder are added beside them, and these names are reserved: oak validate reports a deposit/ file that takes one, and oak release refuses it before writing to Zenodo. Before the upload, oak release removes every file the draft has, so the deposit is exactly these files.
journal.zip holds the journal commit the build used, which the build records in myst.oak.yml under project.options.oaktree-sapling.journal. The deposit runs in a job of its own and fetches that commit, so the archive matches the PDF even when the journal has changed since the build, as when a failed deposit job is re-run, or an editor deposits from the terminal, days later. The record’s Zenodo metadata follows the journal’s zenodo: settings as they are when the deposit runs. A build from journal files that are not a commit of their own repository, such as local changes, cannot be deposited.
When journal.yml sets zenodo.community, oak release asks Zenodo to have that community review a paper’s first-version draft (/api/records/<id>/draft/review), so the editor’s Submit for review on Zenodo sends the draft to the community.[4] A later version’s draft gets no review, since Zenodo refuses one; it stays in the communities the record is already in. A published record joins a community when an editor submits it on Zenodo. --publish-without-review publishes with no review, so a first version published this way is in no community until an editor submits it on Zenodo.
A paper repository that is its own journal (journal_repo: "." in pins.yml)[3] gets no journal.zip, because its journal files are in source.zip at the same commit; the provenance names the paper’s repository and commit as the journal’s. A paper built with --no-journal has no journal to archive.
Stable releases, latest and conformance¶
A stable vX.Y.Z becomes releases/latest on GitHub as soon as it is released, and conformance runs on it after that. oak upgrade with no version moves a paper to releases/latest, so it can move a paper onto a release that has not passed conformance yet. A release that fails conformance stays latest until someone deletes it or releases a newer one (#101). npm gets a release only once conformance passed on it. oak bootstrap pins the running oak’s version, and names the npm package’s latest in its plan when that is newer.
Dev releases¶
The release script refuses a tag that already exists, pre-releases included, because a paper pinned to a moved tag would run a different build under the same name. So each dev release gets a new number, and old ones are deleted in batches, tag included. A paper deposited against one keeps its engine.zip on Zenodo, but the version it names no longer exists.
The npm package¶
The npm package is a second way to get oak, and papers do not use it: their CI runs oak from a checkout, as above.
npm-publish.yml publishes a stable release tag with npm trusted publishing, once its conformance.json says ok, and sets the package version to the tag. It refuses a dev tag: npm versions stay published for good once the 72 hour unpublish window closes, and a dev tag is deleted when pruned.
repository in package.json has to name the repository whose Actions run publishes, because provenance checks it. The workflow sets it to the repository it runs in.
files in package.json is an allowlist. It carries what the CLI reads at runtime, plus all of ci/ and plugins/: papers run ci/ from the checkout and the journal website loads plugins/ from a pinned raw URL, but they are small, and shipping them keeps the tarball a subset of the checkout. prepack runs the typecheck and the bundle. dist/ is gitignored, and npm pack leaves out a missing file without an error, so the bundle has to be built by a hook that runs on both npm pack and npm publish, which prepublishOnly does not.
oak bootstrap and upgrade run from the package. validate, build and start run the version the paper pins, from a clone of its tag when the package is another version (Which engine code runs locally), and so does bootstrap --engine-version naming another version. oak release and its subcommands, such as oak release deposit, always run from a clone of the pinned tag, and the workflow commands from a checkout of it, which carries two things the tarball leaves out:
bin/typst, built for linux x86_64 only. A build run from the package exports the PDF with the typst on the system, and one handed to a clone uses the clone’s when it runs.The git history the
oak releasesubcommands need: they makeengine.zipwithgit archiveover the engine directory, andnode_modules/oaktree-saplingis not a git repository.
So every paper build runs code that passed the release script’s tests, under a version name that always means the same build.
A Linux binary keeps its executable bit on macOS, so
ci/run.shrunsbin/typst --versionbefore putting it onPATH. Checking-xalone would put a binary that fails withExec format errorahead of a working one.oak leaves the
communitiesfield of the legacy Zenodo API unset.