Files
w3cjandClaude Opus 5.5 5b2786c758 ci(release): CI's release workflow, which builds, signs and hands each tag over
.github/workflows/release.yml, CI's half of each release, for a pushed
v* tag, in the release environment, which waits for the maintainer's
approval and holds what the workflow trusts: RELEASE_TAG_SIGNERS, the
SSH keys that sign release tags, and RELEASE_CI_KEY, CI's release key.
The job's token has contents: read, and id-token and attestations write
for the attestation alone, so it can't make or publish a release; the
co-signer does.

- scripts/release.sh --ci TAG DIR: the tag checked against
  DEVVM_RELEASE_SIGNERS, an allowed signers file, never the tagged
  commit's packaging/release-signer, as CI runs the tag's workflow and
  release.sh: annotated, a release's version, its tag object naming
  itself, signed by one of those keys, its commit on main
  (DEVVM_RELEASE_MAIN, refs/remotes/origin/main by default) and holding
  the three release keys. Then --tag's build, with the same signers as
  git's, and DIR with SHA256SUMS and exactly the files it lists, each
  checked against its SHA-256, and not the formulas, which the
  co-signer renders.
- scripts/release.sh --ci-sign TAG DIR: SHA256SUMS signed with CI's key,
  read on standard input into the script's memory and handed to
  minisign through a pipe, never a file or an argument, with the trusted
  comment devvm-release <version>, checked with the tag's
  packaging/keys/release-ci.pub, which can't be marked PLACEHOLDER: a
  key on standard input that isn't CI's is refused, and its signature
  removed. The placeholders' check is placeholder(), one owner for
  --tag's check and this one. --ci and --ci-sign refuse a tag without
  the release keys, pointing at github-setup.md's step 1.
- The workflow: a first step that stops a tag without the release keys
  before anything is installed, with the same pointer, then the tag
  fetched as GitHub has it, minisign alone through
  mise with no cache, the build under the runner's podman, the
  signature, an artifact attestation of every file SHA256SUMS lists
  (subject-checksums), and the artifact release, kept 90 days. Every
  action pinned by its commit; actionlint and zizmor (and zizmor's
  auditor persona) find nothing.
- The base's workflow, base.yml, comes with the published base; the
  workflow's header says where it goes.
- maintaining.md: CI's release workflow, its steps and its trust.

Tests: testdata/script/release_ci.txtar (signers only from
DEVVM_RELEASE_SIGNERS, an empty one, a tag signed by a key git trusts
but the list doesn't hold, not a release's tag, a lightweight tag, a
tag object of another tag, a commit off main, a folder that's there or
relative, the folder's exact files and their checksums, no key on stdin,
another role's key, the right key's signature and its trusted comment,
a second signature, a release-ci.pub marked PLACEHOLDER, a commit with
no release keys for --ci and --ci-sign), failing before the code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-30 21:36:37 -07:00

98 lines
4.7 KiB
YAML

name: Release
# CI's half of each devvm release. For a pushed release tag, v<version>, it checks the tag's SSH
# signature against the signers in the release environment's variable RELEASE_TAG_SIGNERS, never a
# list from the tagged commit, builds the release with scripts/release.sh --tag in its pinned
# container, signs SHA256SUMS with CI's release key, the environment's secret RELEASE_CI_KEY, adds
# a GitHub artifact attestation of every file, and hands SHA256SUMS, its signature and the files it
# lists over as the artifact release. It publishes nothing: its token can only read the repo, and
# the co-signer, a machine of the maintainer's, finds this run, rebuilds the release, and signs,
# makes and publishes it only when its own build matches
# (docs/content/docs/contributing/cosigner.md). The release environment needs the maintainer's
# approval for each run, and only v* tags may use it (docs/content/docs/contributing/maintaining.md's
# CI's release workflow).
#
# The published base's workflow, base.yml, isn't here yet: it comes with the published base, as a
# workflow of its own beside this one, with its own environment, key and artifact, base, which the
# co-signer already reads (cosigner.md's Bases).
on:
push:
tags: ["v*"]
permissions: {}
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
name: Build and sign
runs-on: ubuntu-24.04
timeout-minutes: 120
environment: release
permissions:
contents: read
id-token: write # the attestation's Sigstore certificate for this run
attestations: write # the attestation's record
steps:
# The whole history, for the check that the tag's commit is on main.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
# A tag whose commit has none of the release keys stops here, before anything is installed or
# built: its devvm couldn't check CI's and the co-signer's signatures, so it's published with
# scripts/publish.sh --local until the keys are made. release.sh --ci checks the keys in full.
- name: Check the release keys
run: |
[[ -f packaging/keys/release-ci.pub ]] || {
echo "::error::$GITHUB_REF_NAME has no release keys in packaging/keys: make them first (docs/content/docs/contributing/github-setup.md, step 1), or publish it with scripts/publish.sh --local"
exit 1
}
# The tag as it is on GitHub, its tag object and signature, whatever the checkout made of it.
- name: Fetch the tag
env:
TAG: ${{ github.ref_name }}
run: git fetch --no-tags --force origin "+refs/tags/$TAG:refs/tags/$TAG"
# Only minisign, which signs, as the pinned mise.lock has it, and no cache, as a release builds
# from nothing a branch's run could have left.
- uses: jdx/mise-action@924e7c586e33d7d4bae9c14e26c5d22e2beb6e78 # v5.3.0
with:
version: 2026.11.14
install_args: minisign
cache: false
# The tag's checks against the environment's signers, then the build, in a folder of its own
# that holds SHA256SUMS and exactly the files it lists.
- name: Build
env:
TAG: ${{ github.ref_name }}
SIGNERS: ${{ vars.RELEASE_TAG_SIGNERS }}
DEVVM_RELEASE_RUNTIME: podman
run: |
set -euo pipefail
export DEVVM_RELEASE_SIGNERS=$RUNNER_TEMP/allowed_signers
printf '%s\n' "$SIGNERS" > "$DEVVM_RELEASE_SIGNERS"
scripts/release.sh --ci "$TAG" "$RUNNER_TEMP/release"
# CI's release key goes to minisign through a pipe, never a file, and the signature has to check
# out with the tag's packaging/keys/release-ci.pub, which mustn't be a placeholder.
- name: Sign SHA256SUMS
env:
TAG: ${{ github.ref_name }}
RELEASE_CI_KEY: ${{ secrets.RELEASE_CI_KEY }}
run: |
set -euo pipefail
minisign=$(mise which minisign)
printf '%s\n' "$RELEASE_CI_KEY" | PATH="${minisign%/*}:$PATH" scripts/release.sh --ci-sign "$TAG" "$RUNNER_TEMP/release"
- uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-checksums: ${{ runner.temp }}/release/SHA256SUMS
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: release
path: ${{ runner.temp }}/release/
if-no-files-found: error
# Until the co-signer has published it, and a release waits for the maintainer while it
# bridges from the old key: the most a public repo keeps an artifact.
retention-days: 90