Pushes to the master branch automatically generate documentation. This isn't done via
a GitHub action, but rather uses a webhook to kick off a build job on the server
where the website is hosted.
rtk uses the term "API version" to refer to the major component of a version tag. For
example, the API version for 2.1.0 is 2. This is an API compatibility contract:
builds with the same major version component are guaranteed to be compatible with scripts
written against prior builds of that API version. APIs within a major version may be
extended, but existing code won't break. When breaking API changes are introduced, the
major version is incremented and a new API version is born.
There are two GitHub Workflows for the build and release process:
-
Build: Pushing version tags (e.g.
1.0.5) triggers a workflow to build artifacts for distribution, and pushes those to thedistbranch. The most recent build for each API version is stored in HEAD of thedistbranch. -
Release: When a tag in the form
release/YYYYMMDDTHHMMSSis made against thedistbranch, this triggers another workflow that creates a ReaPack XML from the contents of the tagged branch, and pushes it tositefor official release. As with doc generation, pushes to thesitebranch fire a webhook that causes the webserver to pull the refreshed ReaPack contents and publish it.
It's possible for the build stage to automatically kick off the release workflow:
when the tag created in step 1 is for the most current API version, the build workflow
automatically generates a release/YYYYMMDDTHHMMSS tag after committing the build
artifacts to the dist branch. This in turn launches the release workflow.
In other words, version tags that apply to the latest API version are automatically
released to users. Tagging older major versions (e.g. for critical bug fixes) will build
and push to dist but won't automatically release. A release can be created that includes
the new build for the old API version by one of two methods:
- Subsequently pushing a version tag under the latest API version
- Manually creating and pushing a
release/YYYYMMDDTHHMMSStag against thedistbranch.
The Build workflow is run when a tag is pushed that starts with [0-9]. Its purpose is to assemble
all artifacts needed for distribution to users. The dist repository holds these artifacts and
the ReaPack created in the Release workflow uses GitHub to serve these files directly.
- Build job
- Tag is checked out
- API version is parsed from tag (e.g.
2) rtk.luais built (using the customluaknittool) and stored asbuild/dist/<major>/rtk.lua- The relevant fragment from
CHANGELOG.mdfor the tagged version is pulled and written asbuild/dist/<major>/CHANGELOG.md. This is used by the Release workflow when generating the ReaPack XML. - These artifacts under
build/distare uploaded
- Dist job
- The
distbranch is checked out - Artifacts from the build job are downloaded
- The
MANIFESTfile in thedistbranch is updated to include the new tag. The previous tag for the same API version is removed. - The files generated in the build job are committed and pushed back to the
distbranch. - If the tagged version is within the most current API version, then a release tag is
created against the
distbranch in the formrelease/YYYYMMDDTHHMMSS(which is based on the time of the job execution, not the timestamp of the triggering commit). The new tag is then pushed.- Note: this action uses a GitHub deploy key (stored in a secret variable) because git pushes
authenticated via
${{secrets.GITHUB_TOKEN}}cannot trigger downstream workflows. (See discussion here. Presumably this is a safety mechanism to avoid infinite loops.)
- Note: this action uses a GitHub deploy key (stored in a secret variable) because git pushes
authenticated via
- The
The Release workflow is run when a tag in the form release/YYYYMMDDTHHMMSS is pushed
against the dist branch. Its purpose is to build the ReaPack XML and update site
with the new ReaPack.
ReaPack versions are taken from the highest version that exists in MANIFEST. There is
one exception: when builds for older API versions are produced and a new release needs to
be cut (e.g. to fix a critical issue in an older API version that doesn't exist in the
latest API version), then the ReaPack version will refer to the highest version from
MANIFEST plus a suffix -<n> where <n> is an incrementing number for each release
that lacks a new build for the latest API version. When a release occurs that does
include a new version of the latest API version, then the ReaPack uses this new version
and the -<n> suffix is dropped. Rinse, repeat.
- ReaPack job
- Tag is checked out (which applies
distbranch) in the current directory masterbranch is checked out as./master/-- needed fortools/mkreapack.pysitebranch is checked out as./site/- A custom Python script
master/tools/mkreapack.pyis run to generate a newindex.xmlholding the ReaPack- The file
site/MANIFEST.reapackis read. This file contains theMANIFESTcontents the last time the ReaPack was generated. - All major version subdirectories (
[0-9]*/) are crawled and all files excluding*.mdare added as source files to the new ReaPack version segment. - For each version in
MANIFESTthat does not exist inMANIFEST.reapack, collectCHANGELOG.mdunder the applicable API version directory, and consolidate into a ReaPack-wide changelog - The new ReaPack version number is generated as described earlier
- The existing
site/index.xmlfile is read- All but the most recent 5
<version>elements are stripped - The new version is inserted at the top
- All but the most recent 5
- The new
site/index.xmlandsite/MANIFEST.reapackare written back siteis pushed back, making the newindex.xmllive (via the triggered webhook)
- The file
- Tag is checked out (which applies