Files
Echoion/.gitea/RELEASING.md
T
faumaray d5db7f2d2a
Container CI / release-build (push) Has been cancelled
Nightly: derive version from releases
2026-07-26 05:23:18 +03:00

194 lines
9.5 KiB
Markdown

# Echoion releases on Gitea
Echoion release builds run only through `scripts/release.sh`, whose default
mode builds, tests, validates, and packages inside
`containers/release.Dockerfile`. The runner host only checks out sources and
controls Docker; the workflow never starts `echoiond`.
## One-time Gitea setup
The workflows target the standard `ubuntu-24.04` label advertised by a default
Gitea runner. No custom runner label is required. Use one trusted Linux AMD64
runner with capacity set to one so release and feed writes remain serialized
on Gitea versions that do not implement workflow `concurrency`. The job image
needs Bash, Git with SSH-signature support, OpenSSH client tools, Python 3.10
or newer, OpenSSL with Ed25519 support, coreutils, the Docker CLI, and access
to a Docker daemon. The release builder itself remains containerized.
Every workflow starts by running `docker version` and `docker info`. These
commands verify both the Docker client in the `ubuntu-24.04` job image and
access to the daemon before checkout, secrets, or a long release build are
used. A runner installed as a container must have the host socket mounted:
```yaml
services:
runner:
volumes:
- ./data:/data
- /var/run/docker.sock:/var/run/docker.sock
```
Leave `container.docker_host` at its generated default (`""`) so `act_runner`
passes the detected Docker endpoint to job containers. Do not set it to `-`,
which explicitly prevents that endpoint from being mounted. Restart the runner
after changing its configuration. `scripts/lib/docker-daemon-path.sh` detects
when commands run inside the job container and translates checked-out paths
through that container's Docker mount table. The release wrapper and
control-plane tests both use it because bind mount paths passed to the socket
are resolved by the runner host daemon, not inside the Actions job container.
The SSH checkout steps pin the current `git.faumaray.ru` RSA host key. Its
verified fingerprint is
`SHA256:fugBYnqAnqmTLsGpafVgQF9gPQzJqps7uHvs48blg2A`. If the Gitea SSH host key
is intentionally rotated, verify the new fingerprint through an independent
administrator channel and update `ssh-known-hosts` in all three workflows.
Never work around a rotation by disabling strict host-key checking.
The Docker-capable runner executes only protected `main` pushes, manual runs,
scheduled nightlies, and signed release tags. The container CI workflow does
not run for pull requests because contributor-controlled scripts must not
receive a privileged Docker socket or the private-submodule checkout key. If
pre-merge CI is required, register a separate ephemeral `echoion-pr` runner
without release secrets or host-level Docker access and give it a dedicated
workflow. A global runner such as the default installation shown in Gitea must
only serve repositories you trust: a workflow with Docker-daemon access can
control the runner host.
Enable Actions and add these repository secrets:
| Secret | Purpose |
| --- | --- |
| `RELEASE_CHECKOUT_SSH_KEY` | Read-only deploy key that can clone every private nested repository in `.gitmodules`. |
| `RELEASE_BOT_TOKEN` | PAT owned by a dedicated bot, limited to writing releases, tags, and the `release-feed` branch in this repository. |
| `RELEASE_TAG_ALLOWED_SIGNERS` | Complete OpenSSH `allowed_signers` lines for maintainers allowed to publish `v*` tags. |
| `RELEASE_FEED_ED25519_PRIVATE_KEY` | PEM private key matching `release-keys/echoion-release-2026-07.pub.pem`. Preserve its newlines. |
The release PAT must not be shared with checkout of nested repositories. The
feed signing key must not be stored in Git, runner images, Actions variables,
or release assets.
Create an orphan `release-feed` branch containing a tracked `feeds/`
directory, then protect it so only the release bot can push. Protect the `v*`
tag pattern so only the release maintainers represented by
`RELEASE_TAG_ALLOWED_SIGNERS` can create, update, or delete matching tags. The
workflow requires the exact `v*` rule to have an explicit non-empty user or
team allowlist. Configure it under repository **Settings → Tags → Protected
tags**; a similar pattern such as `v*.*` does not satisfy the release check.
Gitea uses the same allowlist for tag creation and later tag changes; when
immutable release tags are required, add a server-side pre-receive policy that
rejects updates and deletion after creation. Protect `main` in the normal way.
The updater feed URL is:
```text
https://<gitea>/<owner>/<repo>/raw/branch/release-feed/feeds/echoion-runtime.json
```
The embedded updater trust configuration is represented by
`release-keys/official-update-keys.json`. `scripts/release.sh` validates and
embeds that JSON automatically. Release workflows also pass the HTTPS
`release-feed` branch URL through `--official-update-feed-url`, so a fresh
installation has a signed official source without operator-side duplication.
## Stable and beta releases
Create an annotated SSH-signed tag. A version without a prerelease suffix goes
to `stable`; any strict SemVer prerelease goes to `beta`.
```bash
git config gpg.format ssh
git config user.signingkey ~/.ssh/echoion-release-maintainer
git tag -s -a v1.2.3 -m 'Echoion 1.2.3'
test "$(git cat-file -t refs/tags/v1.2.3)" = tag
git push origin v1.2.3
```
The private-key path works without an SSH agent. A `.pub` path may be used
instead when its matching private key is already loaded in `ssh-agent`.
`.gitea/workflows/release.yml` rejects a lightweight tag, a non-SSH
signature, an untrusted signer, a repository without the exact `v*` protected
tag rule and explicit allowlist, a non-SemVer name, an event object unrelated
to the tag, or a checkout whose commit differs from the signed tag target.
Release notes contain the signed tag subject and body but not its SSH signature
armor.
The workflow creates or resumes a draft, replaces incomplete draft assets,
uploads every file in `dist/`, downloads every asset through Gitea, checks
its size and SHA-256, and only then publishes. A rerun against an already
published release is read-only and succeeds only when all remote assets still
match. The signed aggregate feed is committed after release publication; a
feed failure can therefore be retried without replacing a published release.
## Nightly releases
`.gitea/workflows/nightly.yml` runs at 02:17 UTC and can also be dispatched
manually. The highest published `vMAJOR.MINOR.PATCH` release supplies the next
patch as `MAJOR.MINOR.(PATCH+1)-nightly.YYYYMMDD.RUN_NUMBER`. With no published
semantic release, nightlies use the root CMake
`project(Echoion VERSION x.y.z)` value without incrementing it. Drafts, failed
publications, and `nightly-*` releases do not affect the base. Nightlies use the
`nightly` channel, publish as prereleases, and keep the newest 14 Gitea
releases. The aggregate feed also keeps the newest 14 distinct nightly versions
while retaining stable and beta records. Gitea materializes a missing
`nightly-*` Git tag only when the download-verified draft is published; the
publisher then verifies its commit immediately and never moves an existing tag
whose target differs. Stable and beta publishing require their signed tag to
exist before creating a draft. If `nightly-*` is protected separately, allow
the release bot to create and delete it.
Every aggregate envelope expires 45 days after generation. Scheduled
nightlies normally refresh it daily. Alert when the feed branch has not
advanced for more than seven days, and treat 30 days without a successful
signing run as urgent.
## Feed key custody and rotation
The active public key id is `echoion-release-2026-07`. To rotate, generate the
private key on a trusted operator machine:
```bash
umask 077
openssl genpkey -algorithm ED25519 -out echoion-release-YYYY-MM.pem
openssl pkey -in echoion-release-YYYY-MM.pem -pubout \
-out echoion-release-YYYY-MM.pub.pem
```
The PEM public key contains an RFC 8410 SubjectPublicKeyInfo wrapper. The
`ed25519` field in `release-keys/official-update-keys.json` must instead contain
the standard Base64 encoding of only the raw 32-byte public key. Derive that
value with:
```bash
openssl pkey -pubin -in echoion-release-YYYY-MM.pub.pem -outform DER |
tail -c 32 |
base64 -w0
printf '\n'
```
Add the new public key to official builds before signing any feed with it.
Keep the old public key embedded for at least one full update lifetime. During
the first signing run with the new key, pass each prior envelope key explicitly
to `aggregate_update_feed.py` as
`--trusted-existing-key OLD_KEY_ID=OLD_PUBLIC_KEY_PATH`; this permits only
verification of the old envelope and never selects the old key for signing.
Update the signing key id and public-key paths in both release workflows, add
the old-key verification argument while an old envelope may exist, and replace
the private-key secret. The merger verifies the newly generated signature
against the new committed public key before writing either output. Never print
the private key or pass it as a command-line argument.
## Recovery rules
- A failed build creates no Gitea release.
- A failed upload leaves a draft. Rerun the same workflow to replace the
partial draft assets.
- A failed verification never publishes the draft.
- A published release with mismatched assets is immutable; investigate and
create a new version instead of replacing it.
- A failed feed push leaves the published release available but undiscoverable
to auto-update. Rerun the workflow; publication verification is idempotent
and the feed step will run again.
- Never edit `release-feed` manually. The merger verifies the existing
Ed25519 envelope before using any prior entries.