~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

The Release pull follows main by itself

Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:release/in-a-workflow
.knotless/workflows/release-pull.ymlnew+45−0
@@ -0,0 +1,45 @@
# Keeps the `Release <version>` pull in step with main, as `just release`
# does from the owner's machine: on each push to main, deploy/release.sh
# tags the release that last landed `v<version>`, then cuts the next from
# main's change files, force-pushed to release/next with its pull opened
# or brought up to date, and leaves a pull that already releases them
# alone. Merging that pull is the release, which release.yml publishes;
# the push it makes runs this again, which tags it.
#
# It acts as the owner, with RELEASE_PASSWORD, the app password of theirs
# release.yml takes, sealed to this runner for main alone. knope is the
# version pinned here, its release's binary checked against its sum.
image: node:24.22.1
# The shared runner host, as every workflow here.
runners: [runner.knotless.dev]
on:
push: {refs: [refs/heads/main]}
# One at a time, in the order main moved, so an older main's release never
# overwrites a newer one's.
superseded: finish
cache: [/opt/knope]
secrets: [RELEASE_PASSWORD]
env:
REPO: knotless://chadtmiller.com/group-host
KNOTLESS_APPVIEW: https://knotless.dev
KNOPE_VERSION: 0.23.2
KNOPE_SHA256: c64f6281e012fc8e046ebd6f30be76c583e88b9ad55b00c7b1809b030db92eee
steps:
- name: tools
run: |
curl -fsSL "$KNOTLESS_APPVIEW/install.sh" | KNOTLESS_INSTALL_DIR=/usr/local/bin sh
if [ "$(cat /opt/knope/.version 2>/dev/null)" != "$KNOPE_VERSION" ]; then
mkdir -p /opt/knope && cd /tmp
curl -fsSLo knope.tgz "https://github.com/knope-dev/knope/releases/download/knope%2Fv$KNOPE_VERSION/knope-x86_64-unknown-linux-musl.tgz"
echo "$KNOPE_SHA256 knope.tgz" | sha256sum -c -
tar -xzf knope.tgz --strip-components 1 -C /opt/knope knope-x86_64-unknown-linux-musl/knope
echo "$KNOPE_VERSION" > /opt/knope/.version
fi
- name: release
run: |
git config --global --add safe.directory '*'
git config --global user.name "Chad Miller"
git config --global user.email chadtmiller15@gmail.com
owner=${REPO#knotless://}
export KNOTLESS_IDENTIFIER=${owner%%/*} KNOTLESS_PASSWORD="$RELEASE_PASSWORD"
PATH=/opt/knope:$PATH deploy/release.sh
.knotless/workflows/release.yml+3−3
@@ -6,9 +6,9 @@
#
# The host, the command and the console are built as the Dockerfile builds
# them, and the image made from them with no container engine, which this
# runner's jobs have none of (.knotless/image.sh). `just release` keeps a
# pull open that raises the version; once it lands, this publishes it, and
# the next `just release` tags it. A version CHANGELOG.md has no section
# runner's jobs have none of (.knotless/image.sh). release-pull.yml keeps
# a pull open that raises the version; once it lands, this publishes it,
# and release-pull.yml tags it. A version CHANGELOG.md has no section
# for is no release (knope writes one for each), so a pull that touches
# Cargo.toml for another reason publishes nothing, and a version published
# already is left alone.
.knotless/pull.md+4−1
@@ -8,7 +8,10 @@
a body with none of these headings is refused.
Name a pull or issue of this repository by its at:// URI, bare,
not in `code`: its page shows it as a link with its title, and an
issue named so lists this pull on its own page. -->
issue named so lists this pull on its own page.
A change to crates/*/src, web/src, web/messages or lexicons/org
that no one running or using the host sees adds no change file,
and says so in this body on a line of its own: Changeset: none -->
## What changes
deploy/release.sh+4−3
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
# Releases the workspace from main's change files, as the repository's
# owner, signed in with `knotless login`:
# owner: signed in with `knotless login`, or with an app password of
# theirs, as release-pull.yml runs it on each push to main:
#
# deploy/release.sh [--dry-run]
#
@@ -11,7 +12,7 @@
# worktree of its own: `knope release --override-version <version>`,
# committed as `Release <version>`, force-pushed to release/next, and the
# pull of that title opened, or the open one brought up to date. Landing
# that pull is the release; run this again once it has, to tag it.
# that pull is the release; the next run tags it.
#
# The version is worked out here, not by knope: a change file's `minor` or
# `major` bumps 0.x's minor, where knope would bump the patch, and a
@@ -92,7 +93,7 @@ at=$(echo "$main" | cut -c1-12)
notes=$(awk -v v="$version" '/^## / { on = ($2 == v); next } on' CHANGELOG.md)
body=$(mktemp)
cat > "$body" <<EOF
Releases group-host $version, from the $count change files on main: its changelog is below. Merging this pull releases it; \`just release\` then tags it \`v$version\`, and brings this pull up to date as more change files land.
Releases group-host $version, from the $count change files on main: its changelog is below. Merging this pull releases it; the \`release-pull\` workflow then tags it \`v$version\`, and brings this pull up to date as more change files land.
<details>
<summary>deploy/release.sh</summary>
docs/development.md+17−10
@@ -258,10 +258,12 @@ names the bump (`default: patch`, `minor` or `major`), and below it a
heading and a line say what changed for them. The `check` check asks
for one on any pull that changes `crates/*/src`, `web/src`,
`web/messages` or `lexicons/org` (`harness/changes.sh`). A change no one
sees says `Changeset: none` on a line of one of its commits' messages
instead.
sees says `Changeset: none` on a line of the pull's body instead. The
check reads the body when it runs, so after editing the body, run it
again with `knotless run rerun knotless://chadtmiller.com/group-host
--pull <at-uri> --workflow check`.
`just release` (`deploy/release.sh`) cuts a release from main's change
`deploy/release.sh` cuts a release from main's change
files. It works out the version: a `minor` or `major` file bumps 0.x's
minor, where knope alone would bump the patch, and a `patch` file the
patch; from 1.0 on, each bumps its own part. It runs `knope release
@@ -275,13 +277,18 @@ main's change files and still merges with main is left alone, so its
checks don't run again for nothing.
Merging that pull is the release: `release` publishes its image
([below](#the-image)). The next `just release` tags its commit
`v<version>` before it cuts anything, and `mirror` pushes the tag to
GitHub. `just release --dry-run` tags nothing, makes the release commit,
and prints the pull's body, pushing nothing.
The owner runs it, signed in with `knotless login`, with knope
installed (`cargo install knope`).
([below](#the-image)). The script tags its commit `v<version>` the next
time it runs, before it cuts anything, and `mirror` pushes the tag to
GitHub.
The `release-pull` workflow runs it on each push to `main`, as the
owner, with `RELEASE_PASSWORD`, the app password `release` takes too,
and knope 0.23.2's release binary. So the Release pull follows `main`
by itself, and the push that lands it tags it. `just release` runs it
from here instead, as the owner signed in with `knotless login`, with
knope installed (`cargo install knope`). `just release --dry-run` tags
nothing, makes the release commit, and prints the pull's body, pushing
nothing.
## The image
harness/changes.sh+23−8
@@ -2,14 +2,15 @@
# Whether a pull that changes what the host, its console, its MCP tools,
# the command or the lexicons do says so in a change file, as
# AGENTS.md (Versioning) asks: it adds a file under .changeset/, as `knope
# document-change` writes one, or one of its commits says on a line of
# its message
# document-change` writes one, or its body says on a line of its own
#
# Changeset: none
#
# for a change no one running or using them sees. Run by check.yml in a
# pull's run, at its head merged with its base; elsewhere it passes, since
# a push to main carries pulls checked already.
# for a change no one running or using them sees. The body is read from
# the pull's record on its author's PDS, as it stands when this runs: a
# body changed later is read once `check` runs again. Run by check.yml in
# a pull's run, at its head merged with its base; elsewhere it passes,
# since a push to main carries pulls checked already.
set -eu
@@ -29,12 +30,26 @@ if [ -n "$added" ]; then
echo "what people use is changed, and said so in: $added"
exit 0
fi
if git log --format=%B "$base..HEAD" | grep -qx 'Changeset: none'; then
echo "what people use is changed, and a commit says no change file is needed"
# The pull, at://<author>/dev.knotless.pull/<rkey>, read from the PDS its
# author's DID document names.
author=${KNOTLESS_RUN_PULL#at://}
author=${author%%/*}
rkey=${KNOTLESS_RUN_PULL##*/}
case $author in
did:plc:*) doc=https://plc.directory/$author ;;
did:web:*) doc=https://${author#did:web:}/.well-known/did.json ;;
*) echo "the pull's author, $author, is no did:plc or did:web" >&2; exit 1 ;;
esac
command -v jq >/dev/null || { apt-get update -qq && apt-get install -y -qq --no-install-recommends jq >/dev/null; }
pds=$(curl -fsS "$doc" | jq -r '.service[] | select(.id | endswith("#atproto_pds")) | .serviceEndpoint')
record=$(curl -fsS "$pds/xrpc/com.atproto.repo.getRecord?repo=$author&collection=dev.knotless.pull&rkey=$rkey")
if printf '%s\n' "$record" | jq -r '.value.body // ""' | grep -qx 'Changeset: none'; then
echo "what people use is changed, and the pull's body says no change file is needed"
exit 0
fi
echo "what people use is changed, in:"
printf "%s\n" "$changed" | sed 's/^/ /'
echo "but no change file was added under .changeset/. Add one, as \`knope document-change\` writes one (AGENTS.md, Versioning), or, if no one running or using the host sees the change, push a commit saying \`Changeset: none\` on a line of its message."
echo "but no change file was added under .changeset/. Add one, as \`knope document-change\` writes one (AGENTS.md, Versioning), or, if no one running or using the host sees the change, say \`Changeset: none\` on a line of the pull's body, then run this check again: knotless run rerun knotless://$KNOTLESS_RUN_REPO --pull $KNOTLESS_RUN_PULL --workflow check"
harness/changes.shline 54
review.knotless.dev

KNOTLESS_RUN_REPO isn't used anywhere else in the repo. Under set -u, if the runner doesn't set it, this line aborts before the rerun hint prints. Consider ${KNOTLESS_RUN_REPO:-chadtmiller.com/group-host}, or confirm the runner sets it.

exit 1
AGENTS.md+13−9
@@ -220,13 +220,15 @@ pulls into it or into a `feature/` branch:
- `docs`: `just docs`, every link and anchor landing, and the docs site's
build; on a push to `main`, the site deployed.
Two more check nothing. `mirror`: each push to `main` or a tag pushes
Three more check nothing. `mirror`: each push to `main` or a tag pushes
the same commit to a copy on GitHub
(github.com/bluesky-social/group-host), for those who read the code
there. Nothing is pushed to that copy but from here. `release`: once a
Release pull lands and its checks pass, the version's image is built,
published as a knotless release, and copied as it is to
ghcr.io/bluesky-social/group-host (`docs/development.md`, The image).
`release-pull`: each push to `main` tags the release that landed and
keeps the `Release <version>` pull up to date (`deploy/release.sh`).
Every workflow names `runner.knotless.dev`.
On a pull, `web`, `lexicons`, `e2e` and `docs` run only when it changes
@@ -238,14 +240,16 @@ A pull that changes what someone running a group, calling the host or
using the command or the console sees adds a change file under
`.changeset/`, as `knope document-change` writes one
(https://knope.tech): `default: patch`, `minor` or `major` in its front
matter, then a heading and a line for them. `just release`, run by the
owner, turns them into the version and CHANGELOG.md with `knope
release`, in the `Release <version>` pull; merging it releases, and the
next `just release` tags it `v<version>`. Commit titles stay prose: no
conventional commits. The `check` check fails a pull that changes
`crates/*/src`, `web/src`, `web/messages` or `lexicons/org` and adds no
change file, unless one of its commits says, on a line of its message,
`Changeset: none`: for a change no one running or using the host sees.
matter, then a heading and a line for them. The `release-pull`
workflow turns them into the version and CHANGELOG.md with `knope
release`, in the `Release <version>` pull, on each push to `main`;
merging it releases, and the push that does tags it `v<version>`.
Commit titles stay prose: no conventional commits. The `check` check
fails a pull that changes `crates/*/src`, `web/src`, `web/messages` or
`lexicons/org` and adds no change file, unless the pull's body says, on
a line of its own, `Changeset: none`: for a change no one running or
using the host sees. It reads the body as it runs, so after editing the
body, run `check` again.
## Landing a change
Justfile+2−1
@@ -52,7 +52,8 @@ docs-deploy:
# Tags the release that last landed, then cuts the next from main's
# change files as the `Release <version>` pull (deploy/release.sh), as
# the owner, signed in with `knotless login`; --dry-run pushes nothing.
# the owner, signed in with `knotless login`, as the release-pull
# workflow does on each push to main; --dry-run pushes nothing.
release *args:
deploy/release.sh {{args}}
knope.toml+3−2
@@ -2,8 +2,9 @@
# a group, calling the host or using the command sees adds one, with
# `knope document-change`, naming the bump and saying what changed for
# them. `knope release` bumps the workspace's version, writes CHANGELOG.md
# and removes the files it used; `just release` (deploy/release.sh) runs
# it. No conventional commits: commit titles say what changed, for us.
# and removes the files it used; deploy/release.sh runs it, from the
# release-pull workflow or `just release`. No conventional commits:
# commit titles say what changed, for us.
[package]
versioned_files = [