Git snapshot of notplants.bsky.social/lichen-releaser; copied for local development and review.
README.md

Release Pipeline #

Automated release pipeline for lichen. Builds static musl binaries, publishes them as tangled artifacts, pushes Docker images, updates YunoHost and Helm packages.

This repo is checked out inside the lichen repo, as <lichen>/release — the pipeline builds from its parent directory.

Quick start #

ssh root@release-runner     # or ssh root@100.67.126.34
cd /root/lichen
git pull origin main        # get latest code
/root/run-release.sh run <version>

Example: /root/run-release.sh run 0.2.0

Locally, release/lmrelease.sh <version> does the tag, build, publish and Docker steps inside nix develop .#release.

How publishing works #

Tangled has no upload API of its own. A release artifact is an sh.tangled.repo.artifact record in the releasing account's atproto repo, with the binary stored as a blob on that account's PDS. The record points at the sh.tangled.repo record for lichen.page and at the sha1 of the annotated tag object, and the tangled appview picks it up off the firehose.

That means two things:

  • publishing needs an atproto app password, not a forge token
  • release tags must be annotated (git tag -a) — a lightweight tag has no tag object for an artifact to hang off

Artifacts show up at https://tangled.org/notplants.bsky.social/lichen.page/tags and download from https://tangled.org/notplants.bsky.social/lichen.page/tags/<tag-object-sha>/download/<file>.

First-time setup on the release runner #

1. Create .env #

cp /root/lichen/release/.env.example /root/lichen/release/.env

Fill in:

TANGLED_APP_PASSWORD=<app password for notplants.bsky.social>
DOCKER_USERNAME=notplants
DOCKER_PASSWORD=<your docker hub token>

To create an app password: https://bsky.app/settings/app-passwords

2. Set up the tangled SSH key #

The pipeline pushes release tags to the tangled and origin remotes, so the VM needs a key with push access:

ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519 -N "" -C "release-runner"
cat /root/.ssh/id_ed25519.pub
# Add this key to your tangled account

The YunoHost package repo lives on Tangled under notplants-bot in both modes, so the ynh step needs push access there. The release command is binaries plus docker; YunoHost is a separate step, not part of it.

Making a release #

1. Prepare #

ssh root@release-runner
cd /root/lichen
git pull origin main

Make sure HEAD is the commit you want to release.

2. Run the pipeline #

/root/run-release.sh run <version>

Pass the version without a v prefix. The pipeline adds it automatically.

Example: /root/run-release.sh run 0.2.0 creates tag v0.2.0.

3. What happens #

The pipeline runs these steps in order:

  1. Build — cross-compiles 4 static (musl) lichen binaries:

    • minimum (no optional features) × x86_64, aarch64
    • full (shell, git, atproto, oidc, hugo, mdbook) × x86_64, aarch64
    • Binaries are gzip-compressed
  2. Tangled — creates annotated tag v<version>, pushes it to origin and tangled, uploads the compressed binaries to the PDS and attaches them to the tag as sh.tangled.repo.artifact records

  3. Docker — builds and pushes two Docker images to Docker Hub:

    • notplants/lichen-min:<version> (Alpine + minimum binary)
    • notplants/lichen-full:<version> (Alpine + full binary + hugo, git, bubblewrap)
  4. YunoHost — updates manifest.toml and apps.json in the r-lichen_ynh package repo with new version, URLs, and checksums

  5. Helm — updates Chart.yaml appVersion and values.yaml image tag, commits and pushes to the main repo

  6. Tauri (optional) — builds Linux desktop app (.deb, .rpm) if cargo-tauri is installed

4. If something fails #

The pipeline is idempotent and resumable. Just rerun the same command:

/root/run-release.sh run <version>

It checks state.json and skips completed steps. To force a full re-run:

/root/run-release.sh run <version> --force

5. Verify #

  • Tangled artifacts: https://tangled.org/notplants.bsky.social/lichen.page/tags
  • Docker: docker pull notplants/lichen-full:<version>
  • Helm: check charts/lichen/values.yaml in the repo

Running individual steps #

/root/run-release.sh build <version>     # just compile binaries
/root/run-release.sh publish <version>   # just tag + upload tangled artifacts
/root/run-release.sh docker <version>    # just build + push docker
/root/run-release.sh ynh <version>       # just update yunohost package
/root/run-release.sh helm <version>      # just update helm chart
/root/run-release.sh tauri <version>     # just build desktop app

Test mode #

To test against disposable test accounts:

RELEASE_MODE=test /root/run-release.sh run 0.0.1-test

This uses the nptest2 Docker Hub account and the notplants-bot Tangled account for the YunoHost package. Set TANGLED_HANDLE, TANGLED_REPO and TANGLED_APP_PASSWORD in .env to point publishing at a throwaway tangled repo.

What's where #

Path Purpose
/root/run-release.sh Wrapper script (sets PATH and RELEASE_MODE)
/root/lichen/release/lmrelease.sh Local tag + build + publish + docker run
/root/lichen/release/.env Credentials (not in git)
/root/lichen/release/release/ Python pipeline scripts
/root/lichen/release/releases/<version>/ Built binaries
/root/lichen/release/state.json Pipeline state (which steps completed)
/root/lichen/release/logs/<version>.log Build logs
/root/lichen/release/docker/Dockerfile.prebuilt Docker image definition
/root/lichen/release/packages/lichen_ynh/ Cloned YunoHost package repo

Production repos #

What Location
Tangled (code + release artifacts) notplants.bsky.social/lichen.page
Tangled (this repo) notplants.bsky.social/lichen-releaser
Artifact blobs the PDS of notplants.bsky.social
Docker Hub notplants/lichen-min, notplants/lichen-full
YunoHost notplants-bot.bsky.social/r-lichen_ynh (on Tangled)
Helm chart charts/lichen/ in the main repo

Unified executable #

Release assets are lichen-{minimum,full}-{x86_64,aarch64}-linux.gz. Both variants build lichen-cli --bin lichen --no-default-features; only the full variant adds the configured optional features. Docker installs /usr/local/bin/lichen. The minimal image runs lichen server --site /data run; the full image runs lichen server --multi --root-dir /data run. Use matching deployment entrypoints when adopting the new assets. The YunoHost step also migrates the package executable name, service, and install/upgrade/restore scripts to the unified commands. Existing releases retain their original names.

Run the focused release-contract tests with python3 -m unittest discover -s tests.

Cutting a release #

RELEASE_MODE=production \
RELEASE_ENV=/path/to/your/.env.release \
./release/lmrelease.sh 0.5.0

Run it from the lichen checkout, not from this repo — this repo must sit inside it as <lichen>/release, because lmrelease.sh derives the lichen root as its own parent.

RELEASE_MODE has no default and the command refuses without it. config.py's own default is production, so a bare invocation used to go straight at the official accounts with no guard and no announcement. Before doing any work the command prints the mode, the tangled repo, the docker org and the package repo it is aimed at — read that line before letting it continue.

What this command does NOT do #

  • No YunoHost packaging. There is no YunoHost step in lmrelease.sh at all; it runs tag, build, publish and docker, and nothing else. The YunoHost manifest path is untested.
  • No Helm. Same.
  • It does not verify that what it published can be downloaded. It reports success on its own internal signals; those have been wrong before.

What has and has not been exercised #

Verified end to end in test mode against notplants-bot and nptest2: tag push, build, publish, docker, and a second run proving idempotence. Artifacts were downloaded and their sha256 compared against the files that were uploaded.

Production addressing is verified; production execution is not. Every endpoint the production config names exists and resolves — notplants.net, notplants.net/lichen.page, the notplants docker org, the package repo. No production release has been run. A green test run is not coverage of the production path.

Re-running a release is not free, and the two halves differ #

on a re-run
tangled artifacts stay where they are — already-attached artifacts are skipped
docker images move — the digest under a published tag changes

So anyone pinned to the old image digest is pinned to an image no tag points at. The pipeline is strict about tangled tag identity (it refuses a tag at a different object) and permissive about image identity. That asymmetry is deliberate to record, not an accident.

If the command refuses because the tag exists at a different object, it offers two remedies and they cost different things:

  • release a new version — clean throughout;
  • adopt the published tag and re-run — keeps the artifacts, moves the image digests.

Never force-push the tag: that orphans artifacts already attached to the published object.

Preconditions, which live outside both repos #

  • A git committer identity, or the tag step fails with unable to auto-detect email address — true, and naming no release concept. Annotated tags are required, because artifacts attach to the tag object.

  • Submodules initialised by path, not recursively:

    git submodule update --init references/git-remote-pds
    

    --recursive fails: it descends into references/lichen-deploy, whose own .gitmodules still names the retired notplants.bsky.social handle.

  • The <lichen>/release layout, as above.

One thing seen once and never explained #

A git ls-remote to tangled from the build host stalled for three minutes, once, during verification. Both candidate explanations were tested and disproved — it was not an ssh prompt and not IPv6. It has not recurred. If a release stalls like that, it has been seen before and it is not understood; it is not a known defect, and it is not a reason to assume anything is wrong.