Releasing
A release is one git tag v<version> (v0.1.0; v0.2.0-rc.1 for a pre-release). Pushing
it starts two workflows:
| Workflow | Publishes |
|---|---|
release.yml |
the cicord binaries (GitHub Release), the container image ghcr.io/cicord/cicord |
release-npm.yml |
@cicord/sdk, @cicord/client, @cicord/react, @cicord/ui on npm |
create-cicord-portal (the reference portal, forked with cicord portal init) and
@cicord/admin (the admin console, embedded in cicord) are not published. Versions are
semver, 0.x while the API is v1alpha1.
Pre-releases (v0.2.0-rc.1) are described in Pre-releases.
What the workflows do
Section titled “What the workflows do”release.yml (tag v*; Actions → release → Run workflow is a dry run that publishes
nothing):
meta: reads the version from the tag (v0.1.0→0.1.0); a-suffixmakes it a pre-release.build(read-only): builds the web UIs once (pnpmbuild +scripts/sync-ui.sh: admin console, default portal, portal kit) and checks that all of them are there, checks thatinternal/versionis the tag version, then runs GoReleaser (.goreleaser.yaml) with--skip=publish:CGO_ENABLED=0,-trimpath, version and commit in the ldflags, file times set to the commit time (reproducible archives) for linux/amd64, linux/arm64, darwin/amd64, darwin/arm64 and windows/amd64. Outputscicord_<version>_<os>_<arch>.tar.gz(.zipon Windows) withLICENSE,NOTICEandREADME.md,checksums.txt(SHA-256) and one SPDX SBOM per archive (<archive>.sbom.json, syft). Smoke test:cicord versionmust printcicord <version> (<commit>).image:scripts/release-image.shbuilds the Dockerfile for linux/amd64 and linux/arm64 with buildx (cross-compiled, no emulation), with an SBOM and max-mode provenance attached by BuildKit, and pushesghcr.io/cicord/cicord:<version>and:sha-<commit>, plus:<major>.<minor>and:latestfor a version without suffix. It then pushes a GitHub build provenance attestation of the image digest to the registry.release: creates a build provenance attestation for every file listed inchecksums.txt(archives and SBOMs), then the GitHub Release with the files, an install/verify header and GitHub-generated notes; pre-release (not “Latest”) when the tag has a suffix. It runs only whenbuildandimagesucceeded.
release-npm.yml (same tag; Run workflow is a dry run by default): installs, builds
and tests the packages, checks that the four versions are equal and equal to the tag, packs
each package with pnpm pack (which rewrites the workspace: and catalog: specifiers;
the job fails if one is left), then npm publish <tarball> --access public in dependency
order (sdk, client, react, ui), under the dist-tag latest, or next for a version with a
suffix. Versions already on npm are skipped, so a failed run can be re-run. It uses npm
trusted publishing: no npm token, npm trusts the GitHub OIDC identity of this workflow
in the environment npm, and attaches provenance automatically. Never run npm publish
from a package directory: workspace:* would be published verbatim.
Every action is pinned to a commit SHA (tag in the comment). Only GitHub-owned actions and
pnpm/action-setup are used; GoReleaser, syft and BuildKit are pinned releases (checksums or
digest verified).
Each release
Section titled “Each release”- Version. Set
<version>in:internal/version/version.go(Version, the engine version ofgo installbuilds; the release workflow fails if it differs from the tag),Makefile(VERSION ?=) andDockerfile(the twoARG VERSION=defaults),packages/{sdk,client,react,ui}/package.json(and, to keep them in step,packages/{admin,create-cicord-portal}/package.json);@cicord/reactdepends on the same@cicord/clientversion (workspace:*).
- Changelog. Add a
## [<version>] - <date>section to CHANGELOG.md (and the link at the bottom). - Check locally:
make all && make check,pnpm run check, thengoreleaser checkand a local snapshot (goreleaser release --snapshot --clean --skip=publish,sbom, thendist/cicord_<os>_<arch>*/cicord version). For the packages:cd packages/<p> && pnpm pack --dry-run. - Commit (“chore(release): v
”) and push to main; wait for CI. - Dry runs (recommended, required before the first release): Actions → release → Run
workflow, and Actions → release-npm → Run workflow (“dry-run” ticked). The first one is
the only place where syft, the multi-arch builder and the SBOM files run before a tag.
Read the archive list and the
npm publish --dry-runoutput. - Tag and push:
Approve the
Terminal window git tag -a v<version> -m "Cicord <version>"git push origin v<version>npmenvironment deployment only once thereleaserun is green: binaries and images can be rebuilt, an npm version can never be published again. - Verify (below), then announce.
A failed release.yml run can be re-run from the Actions page. If the GitHub Release was
already created, delete it (not the tag) before re-running the release job. Never move a
published tag: make a new patch version.
Pre-releases
Section titled “Pre-releases”A release candidate is x.y.z-rc.N (0.2.0-rc.1, 0.2.0-rc.2, then 0.2.0), cut like a
release: make release VERSION=0.2.0-rc.1 prepares the commit, then tag v0.2.0-rc.1.
- Versions.
scripts/release.shacceptsx.y.zandx.y.z-rc.N(numbers without leading zeros) and refuses a version that is not greater than the current one by semver precedence:0.2.0-rc.2 < 0.2.0-rc.10 < 0.2.0, so it refuses an rc after its release. - What is published. A GitHub prerelease (never “Latest”), the npm packages under the
dist-tag
next(latestdoes not move), and the image tags:0.2.0-rc.1and:sha-<commit>only (no:0.2, no:latest). The automatic updates of the VPS install follow the latest release, so they never install a pre-release, and a server running one moves to the release. - Changelog. A pre-release needs entries under
[Unreleased]but leaves them there: they become the0.2.0section when0.2.0is released, with a compare link from the previous release (v0.1.1...v0.2.0). The GitHub prerelease has the generated notes. - Engine ranges. The
spec.engineranges ofcicord.yamland plugin manifests are checked by plain semver precedence, pre-releases included:0.2.0-rc.1sorts after every0.1.xand before0.2.0. So0.2.0-rc.1satisfies>=0.1.0and>=0.1.0 <0.2.0(like0.1.x, it is below0.2.0), and not>=0.2.0. A range that is meant for the0.2release candidates starts at>=0.2.0-0, which0.2.0satisfies too; repositories and plugins created by a pre-release binary get>=0.2.0-0 <0.3.0. Caret and tilde ranges compare the version numbers instead:^0.1.0and~0.1.0mean0.1.xand do not admit0.2.0-rc.1. Build metadata (+…) is ignored. - Plugin versions. The version ranges of registry plugins (in
bot.yaml) keep the npm rule: a plugin’s pre-release tag is only resolved by a range that names a pre-release (^2.0.0-0), never by*or^1.0.0.cicord plugin publishrequires a version greater than every earlier tag by the same precedence (1.0.0after1.0.0-rc.2, not the reverse).
Verifying a release
Section titled “Verifying a release”Binaries. Download an archive and checksums.txt from the GitHub Release, then:
sha256sum --ignore-missing -c checksums.txt # macOS: shasum -a 256 --ignore-missing -c checksums.txtgh attestation verify cicord_0.1.0_linux_amd64.tar.gz --repo cicord/cicordgh attestation verify checks the Sigstore-signed build provenance: the file was built by a
workflow of cicord/cicord (.github/workflows/release.yml) from the tagged commit.
--signer-workflow cicord/cicord/.github/workflows/release.yml makes the workflow check
explicit. The SBOM of an archive is <archive>.sbom.json next to it.
Container image.
docker buildx imagetools inspect ghcr.io/cicord/cicord:0.1.0 # index: amd64, arm64, attestation manifestsdocker buildx imagetools inspect ghcr.io/cicord/cicord:0.1.0 --format '{{ json .Provenance }}'docker buildx imagetools inspect ghcr.io/cicord/cicord:0.1.0 --format '{{ json .SBOM }}'gh attestation verify oci://ghcr.io/cicord/cicord:0.1.0 --repo cicord/cicordThe GitHub attestation is also pushed to the registry (a Sigstore bundle attached to the
image digest), so cosign v3 should be able to check it without the GitHub API (not tested
yet; gh attestation verify is the reference):
cosign verify-attestation --type slsaprovenance1 \ --certificate-oidc-issuer https://token.actions.githubusercontent.com \ --certificate-identity-regexp '^https://github.com/cicord/cicord/.github/workflows/release.yml@refs/tags/v' \ ghcr.io/cicord/cicord:0.1.0docker run --rm ghcr.io/cicord/cicord:0.1.0 version must print cicord 0.1.0 (<commit>).
npm. npm view @cicord/client@0.1.0; the package page on npmjs.com shows the
provenance badge (built and signed on GitHub Actions, linked to the commit and the
workflow run). In a project: npm audit signatures verifies the registry signatures and
provenance attestations of the installed packages. In an empty directory:
npm install @cicord/sdk @cicord/client @cicord/react @cicord/ui.
One-time setup (owner)
Section titled “One-time setup (owner)”In this order, before the first tag:
- Actions policy. Nothing to allow-list: the release workflows use only GitHub-owned
actions (
actions/checkout,actions/setup-go,actions/setup-node,actions/upload-artifact,actions/download-artifact,actions/attest-build-provenance, which callsactions/attest) andpnpm/action-setup. Under Settings → Actions → General → Workflow permissions, the defaultGITHUB_TOKENpermissions can stay read-only: each job asks for what it needs. - Protect the release tags (Settings → Rules → Rulesets → New tag ruleset, target
v*): restrict creation, update and deletion to maintainers, so that only they can start a release, and forbid moving a tag. - GitHub Packages (ghcr.io). The organization must allow public packages
(organization Settings → Packages → Package creation: Public). The first
release.ymlrun creates the packagecicordlinked to the repository (the image’sorg.opencontainers.image.source); if it is created private, make it public: package page → Package settings → Change visibility → Public. - npm organization. Create the npm organization
cicord(npmjs.com → Add Organization, free for public packages) with your account as owner, and enable 2FA on your account.npm view @cicord/sdkmust answer 404 (free) or show a package you own. If the scope is taken, pick another one and rename the packages: thenameofpackages/{sdk,client,react,ui}/package.json, the@cicord/*imports and dependencies inpackages/,examples/and the docs, the module name@cicord/sdkininternal/buildandinternal/plugin,sdkPackageininternal/cli/plugintests.go, and the package lists ofscripts/sync-ui.shand ofrelease-npm.yml. - First publication from your machine. npm trusted publishers can only be configured
on a package that exists, so publish each package once by hand (
npm loginfirst; npm asks for your 2FA code). Two choices:- Recommended: a placeholder, so that
0.1.0is the first version published by CI, with provenance:After the CI has publishedTerminal window for p in sdk client react ui; dod="$(mktemp -d)"printf '{"name":"@cicord/%s","version":"0.0.0-bootstrap.0","description":"Placeholder: see https://github.com/cicord/cicord","license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/cicord/cicord.git","directory":"packages/%s"}}\n' "$p" "$p" > "$d/package.json"(cd "$d" && npm publish --access public --tag bootstrap)done0.1.0:npm deprecate "@cicord/<p>@0.0.0-bootstrap.0" "placeholder, use a real version"andnpm dist-tag rm @cicord/<p> bootstrapfor each package. - Or publish
0.1.0itself from the tag:pnpm install && pnpm -r --filter "./packages/*" build, then in each of sdk, client, react, ui (in that order):pnpm packandnpm publish cicord-<p>-0.1.0.tgz --access public --provenance=false(the package.json files setpublishConfig.provenance, which only works in CI). Therelease-npmrun ofv0.1.0then skips them:0.1.0has no provenance, the next versions do.
- Recommended: a placeholder, so that
- Trusted publisher, per package (npmjs.com → the package → Settings → Trusted
Publisher → GitHub Actions): organization or user
cicord, repositorycicord, workflow filenamerelease-npm.yml, environmentnpm. Then, on the same page, Publishing access → Require two-factor authentication and disallow tokens: from then on only this workflow (and you, with 2FA) can publish. Delete any npm automation or granular token created for Cicord, and the oldNPM_TOKENrepository or environment secret if one exists. - GitHub environment
npm(Settings → Environments → New environmentnpm): add yourself as required reviewer, so that every publication waits for your approval, and limit deployments to the tagsv*and the branchmain(Deployment branches and tags → Selected). It holds no secret.
After the first npm publication
Section titled “After the first npm publication”- New portals and plugins can depend on the registry:
cicord portal init --from-npm,cicord plugin new --from-npm(orCICORD_FROM_NPM=true), which write"@cicord/client": "^<version>"instead offile:vendor/…and novendor/. Once you are confident, make it the default (fromNPMDefaultininternal/cli/portal.go) and update Custom portal and Writing a plugin. - Existing portals switch with a one-line change per package (
"^<version>"instead of"file:vendor/…"), then delete the@cicord/*entries ofpnpm.overrides/overridesandvendor/; existing plugins replace the@cicord/sdkfile: dependency the same way. - Keep the npm versions and the kit embedded in
cicordin step: acicordrelease embeds the packages of its commit, and--from-npmasks for^that version. Both come from the same tag.