From f1e34d3aa0b73f19356a494b9a39830f4fb0d2d2 Mon Sep 17 00:00:00 2001 From: Volodymyr Vreshch Date: Sun, 22 Nov 2026 11:44:35 +0100 Subject: [PATCH] ci(release): pin cli 0.73.0, hold lines need a reason Claude-Session: https://claude.ai/code/session_01XQkodgygL4W8UcLQDwC212 --- .github/scripts/release-hold.sh | 11 +++++++++++ .github/scripts/release-hold.test.sh | 24 ++++++++++++++++++++++++ .github/workflows/ci.yml | 10 +++++++++- .github/workflows/release.yml | 5 +++-- docs/release.md | 6 +++--- 5 files changed, 50 insertions(+), 6 deletions(-) create mode 100755 .github/scripts/release-hold.sh create mode 100755 .github/scripts/release-hold.test.sh diff --git a/.github/scripts/release-hold.sh b/.github/scripts/release-hold.sh new file mode 100755 index 0000000..373bc7d --- /dev/null +++ b/.github/scripts/release-hold.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# Usage: release-hold.sh ; prints the hold reason, or nothing when not held. +set -euo pipefail +file=$1 +id=$2 +awk -v n="$id" ' + /^[[:space:]]*(#|$)/ { next } + NF < 2 { printf "FAIL release-hold: line %d names %s without a reason\n", NR, $1 > "/dev/stderr"; bad = 1; exit } + $1 == n && !why { $1 = ""; sub(/^[[:space:]]+/, ""); why = $0 } + END { if (bad) exit 1; if (why) print why } +' "$file" diff --git a/.github/scripts/release-hold.test.sh b/.github/scripts/release-hold.test.sh new file mode 100755 index 0000000..d3ddb0c --- /dev/null +++ b/.github/scripts/release-hold.test.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# Tests for release-hold.sh; run from the repo root. +set -euo pipefail +script=.github/scripts/release-hold.sh +dir=$(mktemp -d) +trap 'rm -rf "$dir"' EXIT +fail() { echo "FAIL test: $1"; exit 1; } + +printf '# a comment\n\n \nfixture its images are not writable\n # indented comment\n' > "$dir/ok" +[ "$($script "$dir/ok" fixture)" = "its images are not writable" ] || fail "reason is printed" +[ -z "$($script "$dir/ok" probe)" ] || fail "an extension not named is not held" + +printf '# c\nfixture\n' > "$dir/bare" +if err=$($script "$dir/bare" probe 2>&1); then fail "a line without a reason must fail"; fi +[ "$err" = "FAIL release-hold: line 2 names fixture without a reason" ] || fail "message is exact, got: $err" + +printf 'fixture \t\n' > "$dir/blank-reason" +$script "$dir/blank-reason" fixture >/dev/null 2>&1 && fail "a name with only spaces must fail" + +printf 'a why one\nb\n' > "$dir/other" +$script "$dir/other" a >/dev/null 2>&1 && fail "a bad line fails for every id" + +[ "$($script .github/release-hold fixture | wc -l)" -le 1 ] || fail "the real hold file parses" +echo "PASS release-hold tests" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 831dbbf..c8b07ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -169,10 +169,18 @@ jobs: if: failure() || cancelled() run: docker compose -f .agentage/compose.json logs --no-color --tail 80 || true + scripts: + name: Workflow scripts + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v7 + - run: bash .github/scripts/release-hold.test.sh + # The one required context: green when every picked extension passed, or none was picked. ci-required: name: ci-required - needs: [changes, verify, local] + needs: [changes, verify, local, scripts] if: always() runs-on: ubuntu-latest timeout-minutes: 5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 00b1689..cace216 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,6 +32,7 @@ jobs: cache: 'npm' cache-dependency-path: extensions/*/package-lock.json + # A hold line without a reason fails the run (release-hold.sh), so a typo never releases a held folder. # A held folder leaves this checkout (sparse), so the cli neither sees it nor tags it. - name: Hold the extensions named in .github/release-hold id: hold @@ -40,7 +41,7 @@ jobs: keep=() for d in extensions/*/; do name=$(basename "$d") - why=$(awk -v n="$name" '$1 == n { $1 = ""; sub(/^ +/, ""); print; exit }' .github/release-hold) + why=$(.github/scripts/release-hold.sh .github/release-hold "$name") if [ -n "$why" ]; then echo "AMBER $name: not released: $why" echo "::warning title=$name is held::$why" @@ -70,4 +71,4 @@ jobs: - if: steps.hold.outputs.any == 'true' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: npx -y @agentage/cli@0.71.0 extension release --changed # pinned: the merge-release cli + run: npx -y @agentage/cli@0.73.0 extension release --changed # pinned: the merge-release cli diff --git a/docs/release.md b/docs/release.md index 9325aa5..635cb52 100644 --- a/docs/release.md +++ b/docs/release.md @@ -1,7 +1,7 @@ # Release by merge `.github/workflows/release.yml` runs on each push to master, in the concurrency group `release` -(one run at a time, none cancelled). It runs the cli pinned there, `@agentage/cli@0.71.0`, with +(one run at a time, none cancelled). It runs the cli pinned there, `@agentage/cli@0.73.0`, with `agentage extension release --changed`. The cli reference (`docs/reference.md` of agentage/cli, "extension release") has every step and refusal. @@ -11,12 +11,12 @@ table (`released`, `failed`, `refused`, `unchanged`) and is red when any failed. - A released version never changes. A fix is a new merge, so a new `N`. - Preview what a merge would release, from a clone whose `origin/master` holds the commit: - `GITHUB_REPOSITORY=agentage/examples npx -y @agentage/cli@0.71.0 extension release --changed --dry-run`. + `GITHUB_REPOSITORY=agentage/examples npx -y @agentage/cli@0.73.0 extension release --changed --dry-run`. ## Holds `.github/release-hold` names the folders a merge must not release yet, one line each: the folder -name, then the reason. The release step drops a held folder from its checkout and prints +name, then the reason. A line with a name and no reason fails the run (`FAIL release-hold: line N names without a reason`); `#` lines and blank lines are fine. The release step drops a held folder from its checkout and prints `AMBER : not released: `. Remove the line to release the folder with the next merge. - `fixture`: its image packages `fixture`, `fixture-api` and `fixture-pages` are linked to