Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/scripts/release-hold.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# Usage: release-hold.sh <hold-file> <extension-id>; 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"
24 changes: 24 additions & 0 deletions .github/scripts/release-hold.test.sh
Original file line number Diff line number Diff line change
@@ -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"
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions docs/release.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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 <id> without a reason`); `#` lines and blank lines are fine. The release step drops a held folder from its checkout and prints
`AMBER <name>: not released: <reason>`. Remove the line to release the folder with the next merge.

- `fixture`: its image packages `fixture`, `fixture-api` and `fixture-pages` are linked to
Expand Down