From 54e57f72fdcdd56c8acbae02046a984fdc2d0349 Mon Sep 17 00:00:00 2001 From: Michael Buntarman Date: Wed, 25 Nov 2026 19:34:40 +0700 Subject: [PATCH 1/3] ci(release): draft a release with its upgrade line from a form --- .github/workflows/ci.yaml | 7 +- .github/workflows/draft-release.yaml | 184 ++++++++++ docs/release-process.md | 39 ++- scripts/release/compose-release-notes.sh | 241 +++++++++++++ scripts/release/test-compose-release-notes.sh | 330 ++++++++++++++++++ 5 files changed, 795 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/draft-release.yaml create mode 100755 scripts/release/compose-release-notes.sh create mode 100755 scripts/release/test-compose-release-notes.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fad71cba..8bf607ce 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -56,8 +56,9 @@ jobs: run: go test -count=1 ./config/ ./config/node/ ./lib/tn/ ./lib/constructs/validator_set/ ./stacks/ # Tests the check that release.yaml and publish-node-image.yaml run on each - # release page, and the Telegram announcement that release.yaml posts. The - # announcement test sends only to a local fake Telegram. + # release page, the Telegram announcement that release.yaml posts, and the + # form of draft-release.yaml. The announcement test sends only to a local + # fake Telegram, and the form test reads heights from a fake curl. release-upgrade-line: runs-on: ubuntu-latest if: ${{ !github.event.pull_request.draft }} @@ -67,6 +68,8 @@ jobs: run: scripts/release/test-check-upgrade-line.sh - name: Test the Telegram announcement run: scripts/release/test-announce-telegram.sh + - name: Test the Draft release form + run: scripts/release/test-compose-release-notes.sh acceptance-test: runs-on: ubuntu-latest diff --git a/.github/workflows/draft-release.yaml b/.github/workflows/draft-release.yaml new file mode 100644 index 00000000..9a15bc7b --- /dev/null +++ b/.github/workflows/draft-release.yaml @@ -0,0 +1,184 @@ +name: Draft release + +# Drafts a release from a form. The person releasing gives the tag, the target +# and whether each network must install the release. The run checks every +# answer before it creates anything, writes the upgrade line that release.yaml +# and publish-node-image.yaml check (docs/release-process.md), adds the +# summary and the notes that GitHub generates, and saves the release as a +# draft. +# +# Why a draft: a release that a workflow creates with GITHUB_TOKEN does not +# start other workflows. So this run stops at the draft, and the person +# releasing reviews it and clicks Publish release. That click starts +# release.yaml and publish-node-image.yaml as before: the upgrade line check, +# the binaries, the image and the Telegram announcement. + +run-name: Draft release ${{ inputs.tag }} + +'on': + workflow_dispatch: + inputs: + tag: + description: "Tag of the new release, vX.Y.Z (for example v2.7.0). This run saves a draft; you review it and click Publish release." + required: true + type: string + target: + description: "Branch or commit to release. The draft is pinned to the commit it points at when this runs." + required: true + default: main + type: string + mainnet: + description: "Mainnet: must mainnet nodes install this release by a block? If required, fill in the mainnet block and time." + required: true + default: optional + type: choice + options: + - optional + - required + mainnet_block: + description: "Mainnet block from which the release is required, for example 3300000. Only when mainnet is required; leave empty otherwise." + required: false + type: string + mainnet_time: + description: "About when that mainnet block comes, in UTC: YYYY-MM-DD HH:MM. At least 7 days from now. Only when mainnet is required; leave empty otherwise." + required: false + type: string + testnet: + description: "Testnet: must testnet nodes install this release by a block? If required, fill in the testnet block and time." + required: true + default: optional + type: choice + options: + - optional + - required + testnet_block: + description: "Testnet block from which the release is required, for example 16300000. Only when testnet is required; leave empty otherwise." + required: false + type: string + testnet_time: + description: "About when that testnet block comes, in UTC: YYYY-MM-DD HH:MM. Only when testnet is required; leave empty otherwise." + required: false + type: string + summary: + description: "Optional. One line shown under the upgrade line, above the generated notes." + required: false + type: string + short_notice: + description: "Short notice: allow a mainnet time less than 7 days away, for an urgent release. The run warns." + required: false + default: false + type: boolean + +permissions: + contents: write + +concurrency: + group: draft-release-${{ inputs.tag }} + cancel-in-progress: false + +jobs: + draft: + name: Draft the release + runs-on: ubuntu-latest + timeout-minutes: 10 + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ inputs.tag }} + TARGET: ${{ inputs.target }} + MAINNET: ${{ inputs.mainnet }} + MAINNET_BLOCK: ${{ inputs.mainnet_block }} + MAINNET_TIME: ${{ inputs.mainnet_time }} + TESTNET: ${{ inputs.testnet }} + TESTNET_BLOCK: ${{ inputs.testnet_block }} + TESTNET_TIME: ${{ inputs.testnet_time }} + SUMMARY: ${{ inputs.summary }} + SHORT_NOTICE: ${{ inputs.short_notice }} + # Public gateways, read for the current heights only. + MAINNET_RPC: https://gateway.mainnet.truf.network/rpc/v1 + TESTNET_RPC: https://gateway.testnet.truf.network/rpc/v1 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + persist-credentials: false + + # Refuses a wrong tag, a missing or stray block or time, a time in the + # wrong form and a mainnet time less than 7 days away; warns when a block + # is not above its network's current height. + - name: Check the form and write the upgrade line + run: | + scripts/release/compose-release-notes.sh \ + --tag "$TAG" --target "$TARGET" \ + --mainnet "$MAINNET" --mainnet-block "$MAINNET_BLOCK" --mainnet-time "$MAINNET_TIME" \ + --testnet "$TESTNET" --testnet-block "$TESTNET_BLOCK" --testnet-time "$TESTNET_TIME" \ + --summary "$SUMMARY" --short-notice "$SHORT_NOTICE" \ + --mainnet-rpc "$MAINNET_RPC" --testnet-rpc "$TESTNET_RPC" \ + > "$RUNNER_TEMP/head.md" + + - name: Check the tag and the target + id: target + run: | + refs=$(gh api "repos/$GITHUB_REPOSITORY/git/matching-refs/tags/$TAG" --jq '.[].ref') + if grep -qxF "refs/tags/$TAG" <<<"$refs"; then + echo "::error::The tag $TAG exists already. Pick a new tag." + exit 1 + fi + # Drafts have no tag yet, so the releases are read too. + releases=$(gh api --paginate "repos/$GITHUB_REPOSITORY/releases?per_page=100" --jq '.[].tag_name') + if grep -qxF "$TAG" <<<"$releases"; then + echo "::error::A release or a draft for $TAG exists already. Finish or delete it on the releases page, or pick a new tag." + exit 1 + fi + if ! sha=$(gh api "repos/$GITHUB_REPOSITORY/commits/$TARGET" --jq .sha); then + echo "::error::The target $TARGET is not a branch, tag or commit of this repository." + exit 1 + fi + echo "The target $TARGET is commit $sha." + echo "sha=$sha" >> "$GITHUB_OUTPUT" + + # generate-notes only returns text; it creates nothing. GitHub picks the + # previous release as the start of the list. + - name: Write the release notes + env: + SHA: ${{ steps.target.outputs.sha }} + run: | + gh api -X POST "repos/$GITHUB_REPOSITORY/releases/generate-notes" \ + -f tag_name="$TAG" -f target_commitish="$SHA" --jq .body > "$RUNNER_TEMP/notes.md" + { cat "$RUNNER_TEMP/head.md"; echo; cat "$RUNNER_TEMP/notes.md"; } > "$RUNNER_TEMP/body.md" + scripts/release/check-upgrade-line.sh < "$RUNNER_TEMP/body.md" + + - name: Create the draft release + id: draft + env: + SHA: ${{ steps.target.outputs.sha }} + run: | + url=$(gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --draft \ + --title "$TAG" --target "$SHA" --notes-file "$RUNNER_TEMP/body.md") + echo "Draft release: $url" + echo "url=$url" >> "$GITHUB_OUTPUT" + + - name: Write the run summary + env: + SHA: ${{ steps.target.outputs.sha }} + DRAFT_URL: ${{ steps.draft.outputs.url }} + run: | + body=$RUNNER_TEMP/body.md + { + echo "## Draft release $TAG" + echo + echo "Review it, then click **Publish release**: $DRAFT_URL" + echo + echo "Target: \`$TARGET\`, commit \`$SHA\`." + echo + echo "### Upgrade line" + echo + echo '```text' + head -n 1 "$body" + echo '```' + echo + echo "### Telegram message after you publish" + echo + echo '```text' + scripts/release/announce-telegram.sh --dry-run "$TAG" "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/$TAG" < "$body" + echo '```' + } >> "$GITHUB_STEP_SUMMARY" diff --git a/docs/release-process.md b/docs/release-process.md index c3ebdfca..02d562a2 100644 --- a/docs/release-process.md +++ b/docs/release-process.md @@ -6,6 +6,8 @@ This page is for maintainers who publish a TN node release. Node operators read The release notes open with one line that says whether node operators must install the release. `release.yaml` and `publish-node-image.yaml` check that line before they build anything. A release without it gets no binaries and no image, and the `latest` image tag does not move. +The **Draft release** form writes this line for you; see [Publishing a Release](#publishing-a-release). + The line is exactly one of these four forms: - Optional on both networks: @@ -60,7 +62,7 @@ A required release must run every block before its block the same way as the rel ## Notice for a Required Release -- Publish a required release at least 7 days before its mainnet block, and state its testnet block on the same line. +- Publish a required release at least 7 days before its mainnet block, and state its testnet block on the same line. The **Draft release** form refuses a mainnet time less than 7 days away unless **Short notice** is ticked. - Pick each block from the measured block rate, as in [Pick the activation height](maa-rollout.md#pick-the-activation-height), and round the time. - A migration that needs the new release, for example one whose actions call a method only that release has, is applied on a network only after the release's block on that network. - Where the change waits on an on-chain network parameter that the release adds, as `maa_exec` waits on `maa_activation_height`, the release's block is the earliest block in which the resolution that sets the parameter may pass, not the height that resolution sets. A node on an older release cannot read the parameter and halts once that resolution passes, whatever height it sets (see [Failure modes and rollback](maa-rollout.md#failure-modes-and-rollback)). If operators need more time, hold the resolution back and edit the release notes to the new block and time. After the resolution has passed, a follow-up resolution can still move the activation height later (see [Re-scheduling](maa-rollout.md#re-scheduling)), but that only delays the change on upgraded nodes and gives no more time to a node on an older release. @@ -90,10 +92,39 @@ Without `--dry-run`, it posts the message to the chat in `TELEGRAM_CHAT_ID`, in ## Publishing a Release +The normal way is the **Draft release** form. It writes the upgrade line, adds the notes that GitHub generates, and saves the release as a draft for you to review and publish. Writing the notes by hand is the fallback. + +### With the Draft Release Form + +1. On the repository's **Actions** tab, choose **Draft release**, then **Run workflow**. Leave **Use workflow from** on `main`. +2. Fill in the form: + - **Tag**: the new release's tag, `vX.Y.Z`. No release, draft or tag may have it yet. + - **Target**: the branch or commit to release, `main` by default. The draft is pinned to the commit that the target points at when the run starts, so a later merge does not slip into the release. + - **Mainnet** and **Testnet**: `optional` or `required`; see [Optional or Required](#optional-or-required). + - For each required network, its **block** and its **time**, in UTC as `YYYY-MM-DD HH:MM`; see [Notice for a Required Release](#notice-for-a-required-release). Leave both empty for an optional network. The run refuses a block or a time given for an optional network, so that nothing you typed is dropped. + - **Summary**: optional. One line shown under the upgrade line, above the generated notes. + - **Short notice**: tick it only for an urgent release whose mainnet time is less than 7 days away. The run then warns instead of refusing. +3. Click **Run workflow**. The run checks every answer before it creates anything and lists each problem it finds. It warns when a required block is not above that network's current height. It writes the notes: the upgrade line, then the summary when given, then the notes that GitHub generates since the previous release. It checks them with `check-upgrade-line.sh` and saves them as a draft release. +4. Open the run. Its summary shows the upgrade line, the Telegram message that the release will post, and the link to the draft. +5. Open the draft and review it. You can edit it, keeping the upgrade line first. Editing a draft starts no workflow. +6. Click **Publish release**. That starts the workflows in [What Publishing Starts](#what-publishing-starts). Publish soon after the run: the 7 days of notice count from the run, not from the publish. + +The run stops at a draft because a release that a workflow creates with its `GITHUB_TOKEN` does not start other workflows. Your click on **Publish release** does, so the check, the binaries, the image and the Telegram announcement run as for a release written by hand. + +`scripts/release/compose-release-notes.sh` checks the form and writes the upgrade line. `scripts/release/test-compose-release-notes.sh` tests it; CI runs it. + +### By Hand + +When the form cannot be used: + 1. Draft the release from its tag, generate the notes, and put the upgrade line first. 2. Check the notes with `scripts/release/check-upgrade-line.sh`. -3. Publish. `release.yaml` builds the four `kwild` tarballs, uploads them to the release and posts the Telegram announcement. `publish-node-image.yaml` pushes the image as `v`, ``, `sha-` and `latest`. -4. If the line was missing or wrong, both workflows fail before they build. Edit the release to fix the line. `release.yaml` runs again on the edit, uploads the binaries and posts the announcement. `publish-node-image.yaml` runs only when a release is published, so run **Publish Node Image** by hand on the release tag with **Also tag this build as latest**. A manual run has no release notes to read, so it skips the check. -5. After a required release, run **Build AMI** so that nodes launched from the AMI start on it. +3. Publish. + +### What Publishing Starts + +1. `release.yaml` builds the four `kwild` tarballs, uploads them to the release and posts the Telegram announcement. `publish-node-image.yaml` pushes the image as `v`, ``, `sha-` and `latest`. +2. If the line was missing or wrong, both workflows fail before they build. Edit the release to fix the line. `release.yaml` runs again on the edit, uploads the binaries and posts the announcement. `publish-node-image.yaml` runs only when a release is published, so run **Publish Node Image** by hand on the release tag with **Also tag this build as latest**. A manual run has no release notes to read, so it skips the check. +3. After a required release, run **Build AMI** so that nodes launched from the AMI start on it. Every edit of the release notes runs `release.yaml` again, which builds and uploads the binaries again. It does not post the announcement again. diff --git a/scripts/release/compose-release-notes.sh b/scripts/release/compose-release-notes.sh new file mode 100755 index 00000000..a8acd196 --- /dev/null +++ b/scripts/release/compose-release-notes.sh @@ -0,0 +1,241 @@ +#!/usr/bin/env bash +# Checks the answers of the Draft release form (.github/workflows/draft-release.yaml) +# and prints the top of the release notes: the upgrade line, in one of the forms +# that check-upgrade-line.sh accepts (docs/release-process.md), then, when there +# is a summary, a blank line and the summary. The workflow adds a blank line and +# the notes that GitHub generates. +# +# Usage: scripts/release/compose-release-notes.sh --tag vX.Y.Z [OPTION VALUE]... > head.md +# +# --tag vX.Y.Z the new release's tag +# --target REF the branch or commit to release (default +# main); only its spelling is checked here +# --mainnet optional|required default optional +# --mainnet-block N only when mainnet is required +# --mainnet-time 'YYYY-MM-DD HH:MM' in UTC, only when mainnet is required +# --testnet optional|required default optional +# --testnet-block N only when testnet is required +# --testnet-time 'YYYY-MM-DD HH:MM' in UTC, only when testnet is required +# --summary TEXT one line under the upgrade line +# --short-notice true|false allow a mainnet time less than 7 days +# away, with a warning (default false) +# --mainnet-rpc URL read the mainnet height from this JSON-RPC +# URL and warn when the mainnet block is not +# above it; skipped when it does not answer +# --testnet-rpc URL the same for testnet +# --now 'YYYY-MM-DD HH:MM' for tests: the time to count from +# +# An empty block, time, summary or URL is the same as leaving it out. Every +# answer is checked before anything is printed, and each problem prints as one +# error. Exits 1 when an answer is refused, and 2 on wrong arguments. +set -euo pipefail + +usage() { + echo "usage: $0 --tag vX.Y.Z [OPTION VALUE]...; the options are listed at the top of the script" >&2 + exit 2 +} + +declare -A opt=( + [tag]='' [target]=main + [mainnet]=optional [mainnet-block]='' [mainnet-time]='' [mainnet-rpc]='' + [testnet]=optional [testnet-block]='' [testnet-time]='' [testnet-rpc]='' + [summary]='' [short-notice]=false [now]='' +) +while [ $# -gt 0 ]; do + name=${1#--} + [ "$1" != "$name" ] && [ -n "$name" ] && [ -n "${opt[$name]+set}" ] && [ $# -ge 2 ] || usage + opt[$name]=$2 + shift 2 +done + +errors=0 +say() { + if [ "${GITHUB_ACTIONS:-}" = true ]; then + echo "::$1::$2" >&2 + else + echo "$1: $2" >&2 + fi +} +error() { + errors=$((errors + 1)) + say error "$1" +} + +# A value as it prints in a message: control characters become ?, so that it +# prints as one line. +show() { printf '%s' "${1//[[:cntrl:]]/?}"; } + +trim() { + local s=$1 + s=${s#"${s%%[![:space:]]*}"} + s=${s%"${s##*[![:space:]]}"} + printf '%s' "$s" +} + +# Prints the seconds from 1970-01-01 00:00 UTC to a 'YYYY-MM-DD HH:MM' time in +# UTC. Fails when the text is not such a time or the date does not exist. +epoch() { + local re='^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2})$' + [[ $1 =~ $re ]] || return 1 + local y=$((10#${BASH_REMATCH[1]})) m=$((10#${BASH_REMATCH[2]})) d=$((10#${BASH_REMATCH[3]})) + local hh=$((10#${BASH_REMATCH[4]})) mm=$((10#${BASH_REMATCH[5]})) + local last=(31 28 31 30 31 30 31 31 30 31 30 31) + if ((y % 4 == 0 && (y % 100 != 0 || y % 400 == 0))); then + last[1]=29 + fi + ((y >= 1970 && m >= 1 && m <= 12 && d >= 1 && d <= last[m - 1] && hh <= 23 && mm <= 59)) || return 1 + # Days from 1970-01-01, by Howard Hinnant's days_from_civil. + if ((m <= 2)); then + y=$((y - 1)) + fi + local era=$((y / 400)) + local yoe=$((y - era * 400)) + local doy=$(((153 * (m > 2 ? m - 3 : m + 9) + 2) / 5 + d - 1)) + local doe=$((yoe * 365 + yoe / 4 - yoe / 100 + doy)) + echo $(((era * 146097 + doe - 719468) * 86400 + hh * 3600 + mm * 60)) +} + +# Reads a network's current height from a node's JSON-RPC URL. +height() { + local reply re='"block_height":([0-9]+)' + reply=$(curl -sS -m 20 -X POST -H 'content-type: application/json' \ + --data '{"jsonrpc":"2.0","id":1,"method":"user.chain_info","params":{}}' "$1" 2>/dev/null) || return 1 + [[ $reply =~ $re ]] || return 1 + printf '%s' "${BASH_REMATCH[1]}" +} + +# True when the whole number $1 is greater than the whole number $2, at any length. +above() { + ((${#1} > ${#2})) || { ((${#1} == ${#2})) && [[ $1 > $2 ]]; } +} + +if [ -n "${opt[now]}" ]; then + now=$(epoch "${opt[now]}") || usage +else + printf -v now '%(%s)T' -1 +fi +week=$((7 * 24 * 3600)) + +tag=${opt[tag]} +if [ -z "$tag" ]; then + error "The tag is missing. Give the new release's tag, such as v2.7.0." +elif ! [[ $tag =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then + error "The tag '$(show "$tag")' is not of the form vX.Y.Z, such as v2.7.0." +fi + +target=${opt[target]} +if [ -z "$target" ]; then + error "The target is empty. Give the branch or the commit to release, such as main." +elif ! [[ $target =~ ^[A-Za-z0-9][A-Za-z0-9._/-]*$ ]] || [[ $target == *..* || $target == *//* || $target == */ ]]; then + error "The target '$(show "$target")' is not a branch name or a commit. Give the branch or the commit to release, such as main." +fi + +short_notice=${opt[short-notice]} +case $short_notice in +true | false) ;; +*) error "Short notice is '$(show "$short_notice")'; it is true or false." ;; +esac + +summary=$(trim "${opt[summary]}") +if [[ $summary == *[[:cntrl:]]* ]]; then + error "The summary must be one line of text." +fi + +declare -A part=() +for net in mainnet testnet; do + choice=${opt[$net]} + example=3300000 + if [ "$net" = testnet ]; then + example=16300000 + fi + block=$(trim "${opt[$net-block]}") + when=$(trim "${opt[$net-time]}") + when=${when% UTC} + case $choice in + optional) + part[$net]="optional on $net" + # A block or a time for an optional network is a mistake in the form: + # either the network is required, or the value is stray. + if [ -n "$block" ]; then + error "The $net block is '$(show "$block")', but $net is optional. Choose required for $net, or leave the $net block empty." + fi + if [ -n "$when" ]; then + error "The $net time is '$(show "$when")', but $net is optional. Choose required for $net, or leave the $net time empty." + fi + continue + ;; + required) ;; + *) + error "The $net choice is '$(show "$choice")'; it is optional or required." + continue + ;; + esac + + part[$net]="required on $net from block $block (about $when UTC)" + if [ -z "$block" ]; then + error "${net^} is required, so give the $net block from which it is required, such as $example." + block_ok=no + elif ! [[ $block =~ ^[1-9][0-9]*$ ]]; then + error "The $net block '$(show "$block")' is not a block height. Write it as a whole number with no separators, such as $example." + block_ok=no + else + block_ok=yes + fi + + if [ -z "$when" ]; then + error "${net^} is required, so give the time of the $net block, in UTC as YYYY-MM-DD HH:MM, such as 2026-12-10 12:00." + elif ! at=$(epoch "$when"); then + error "The $net time '$(show "$when")' is not a UTC time of the form YYYY-MM-DD HH:MM, such as 2026-12-10 12:00." + elif [ "$net" = mainnet ] && ((at < now + week)); then + # docs/release-process.md: publish a required release at least 7 days + # before its mainnet block. + if [ "$short_notice" = true ]; then + if ((at < now)); then + say warning "The mainnet time $when UTC has passed. Short notice is ticked, so the draft goes ahead; check the block and the time." + else + say warning "The mainnet time $when UTC is less than 7 days away. Short notice is ticked, so the draft goes ahead, without the 7 days of notice that docs/release-process.md asks for." + fi + else + TZ=UTC printf -v earliest '%(%Y-%m-%d %H:%M)T' $(((now + week + 59) / 60 * 60)) + error "The mainnet time $when UTC is less than 7 days away. A required release goes out at least 7 days before its mainnet block, so pick a block at $earliest UTC or later, or tick short notice for an urgent release." + fi + elif [ "$net" = mainnet ] && [ "$short_notice" = true ]; then + say notice "Short notice is ticked, but the mainnet time is 7 days away or more, so it changes nothing." + elif [ "$net" = testnet ] && ((at < now)); then + say warning "The testnet time $when UTC has passed. Check the testnet block and time." + fi + + rpc=$(trim "${opt[$net-rpc]}") + if [ "$block_ok" = yes ] && [ -n "$rpc" ]; then + if current=$(height "$rpc"); then + if ! above "$block" "$current"; then + say warning "The $net block $block is not above the current $net height $current, read from $rpc. Nodes are past it already; check the block." + fi + else + say notice "Could not read the current $net height from $rpc, so the $net block is not compared with it." + fi + fi +done + +if [ "${opt[mainnet]}" != required ] && [ "$short_notice" = true ]; then + say notice "Short notice is ticked, but mainnet is not required, so it changes nothing." +fi + +if [ "$errors" -ne 0 ]; then + echo "The form has $errors problem(s). Fix them and run it again." >&2 + exit 1 +fi + +if [ "${opt[mainnet]}" = optional ] && [ "${opt[testnet]}" = optional ]; then + line='Upgrade: optional.' +else + line="Upgrade: ${part[mainnet]}, ${part[testnet]}." +fi +# The same check that release.yaml and publish-node-image.yaml run on the +# release page. Its "Upgrade line:" output goes to stderr. +printf '%s\n' "$line" | "$(dirname "$0")/check-upgrade-line.sh" >&2 + +printf '%s\n' "$line" +if [ -n "$summary" ]; then + printf '\n%s\n' "$summary" +fi diff --git a/scripts/release/test-compose-release-notes.sh b/scripts/release/test-compose-release-notes.sh new file mode 100755 index 00000000..2b3a3eee --- /dev/null +++ b/scripts/release/test-compose-release-notes.sh @@ -0,0 +1,330 @@ +#!/usr/bin/env bash +# Tests scripts/release/compose-release-notes.sh, the step of the Draft release +# form that checks the answers and writes the upgrade line: every combination of +# optional and required networks, with and without a summary, every refusal, +# the short-notice and past-time warnings, the calendar, and the height check +# against a fake curl. Every line it prints must pass check-upgrade-line.sh. +# +# Usage: scripts/release/test-compose-release-notes.sh +set -euo pipefail + +dir=$(cd "$(dirname "$0")" && pwd) +compose=$dir/compose-release-notes.sh +check=$dir/check-upgrade-line.sh +announce=$dir/announce-telegram.sh +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT +mkdir -p "$tmp/bin" + +unset GITHUB_ACTIONS FAKE_MAINNET FAKE_TESTNET + +# The fake curl answers a height read from FAKE_MAINNET or FAKE_TESTNET, +# chosen by the URL, and fails as an unreachable host when that is empty. It +# records its arguments, one per line. +cat >"$tmp/bin/curl" <>"$tmp/curl-argv" +case "\${*: -1}" in +*mainnet*) reply=\${FAKE_MAINNET:-} ;; +*testnet*) reply=\${FAKE_TESTNET:-} ;; +*) reply= ;; +esac +[ -n "\$reply" ] || exit 7 +printf '%s' "\$reply" +EOF +chmod +x "$tmp/bin/curl" + +now='2026-11-25 12:00' +mainnet=(--mainnet required --mainnet-block 3300000 --mainnet-time '2026-12-10 12:00') +testnet=(--testnet required --testnet-block 16300000 --testnet-time '2026-12-03 12:00') +line_optional='Upgrade: optional.' +line_both='Upgrade: required on mainnet from block 3300000 (about 2026-12-10 12:00 UTC), required on testnet from block 16300000 (about 2026-12-03 12:00 UTC).' +line_mainnet='Upgrade: required on mainnet from block 3300000 (about 2026-12-10 12:00 UTC), optional on testnet.' +line_testnet='Upgrade: optional on mainnet, required on testnet from block 16300000 (about 2026-12-03 12:00 UTC).' + +fails=0 +settings=() +pass() { echo "ok $1"; } +fail() { + echo "FAIL $1" + fails=$((fails + 1)) +} + +# is NAME GOT WANT +is() { + if [ "$2" = "$3" ]; then + pass "$1" + else + fail "$1" + diff <(printf '%s\n' "$3") <(printf '%s\n' "$2") | sed 's/^/ /' || true + fi +} + +# has NAME TEXT PART +has() { + if [[ $2 == *"$3"* ]]; then + pass "$1" + else + fail "$1: no '$3' in: $2" + fi +} + +# lacks NAME TEXT PART +lacks() { + if [[ $2 == *"$3"* ]]; then + fail "$1: '$3' in: $2" + else + pass "$1" + fi +} + +# run ARG...: runs the script at $now with the settings in $settings and the +# fake curl; sets status, out (exactly as printed) and err. +run() { + rm -f "$tmp/curl-argv" + status=0 + env PATH="$tmp/bin:$PATH" ${settings[@]+"${settings[@]}"} \ + "$compose" --now "$now" "$@" >"$tmp/out" 2>"$tmp/err" || status=$? + out=$( + cat "$tmp/out" + echo . + ) + out=${out%.} + err=$(<"$tmp/err") +} + +# passes_check NAME: the printed text passes check-upgrade-line.sh. +passes_check() { + if "$check" <"$tmp/out" >/dev/null 2>&1; then + pass "$1: check-upgrade-line.sh accepts it" + else + fail "$1: check-upgrade-line.sh refuses: $out" + fi +} + +# accepts NAME WANT ARG...: exit 0, prints WANT exactly, which passes the check, +# and says nothing but the upgrade line on stderr. +accepts() { + local name=$1 want=$2 + shift 2 + run "$@" + is "$name: exit" "$status" 0 + is "$name: notes" "$out" "$want" + passes_check "$name" + is "$name: stderr" "$err" "Upgrade line: ${want%%$'\n'*}" +} + +# refuses NAME MESSAGE ARG...: exit 1, prints nothing, and says MESSAGE. +refuses() { + local name=$1 message=$2 + shift 2 + run "$@" + is "refused, $name: exit" "$status" 1 + is "refused, $name: prints nothing" "$out" "" + has "refused, $name: says why" "$err" "error: $message" + has "refused, $name: counts the problems" "$err" 'The form has 1 problem(s). Fix them and run it again.' +} + +# warns NAME KIND MESSAGE ARG...: exit 0, says KIND: MESSAGE, and prints a +# line that passes the check. +warns() { + local name=$1 kind=$2 message=$3 + shift 3 + run "$@" + is "$name: exit" "$status" 0 + has "$name: $kind" "$err" "$kind: $message" + passes_check "$name" +} + +# Every combination, with and without a summary. The Telegram message that the +# release will post, from announce-telegram.sh --dry-run, names the right +# networks. +for summary in '' 'Adds the new market actions.'; do + with=${summary:+, with a summary} + more=${summary:+$'\n\n'$summary} + for combo in optional mainnet testnet both; do + case $combo in + optional) args=() line=$line_optional title='TN node v2.7.0 is out. Optional:' ;; + mainnet) args=("${mainnet[@]}") line=$line_mainnet title='REQUIRED on mainnet: TN node v2.7.0' ;; + testnet) args=("${testnet[@]}") line=$line_testnet title='REQUIRED on testnet: TN node v2.7.0' ;; + both) args=("${mainnet[@]}" "${testnet[@]}") line=$line_both title='REQUIRED: TN node v2.7.0' ;; + esac + accepts "$combo$with" "$line$more"$'\n' --tag v2.7.0 ${args[@]+"${args[@]}"} --summary "$summary" + message=$("$announce" --dry-run v2.7.0 https://github.com/trufnetwork/node/releases/tag/v2.7.0 <"$tmp/out" 2>/dev/null) || true + has "$combo$with: the Telegram message" "$message" "$title" + done +done + +# The defaults, and values with spaces around them. A time may end in UTC. +accepts 'no options but the tag' "$line_optional"$'\n' --tag v2.7.0 +accepts 'explicit optional and target' "$line_optional"$'\n' --tag v2.7.0 --target main --mainnet optional --testnet optional --short-notice false +accepts 'a commit as the target' "$line_optional"$'\n' --tag v2.7.0 --target 8e70cf06d80f9975c31930ed710ef88a2d2e89a8 +accepts 'a branch with a slash as the target' "$line_optional"$'\n' --tag v2.7.0 --target release/v2.7 +accepts 'spaces around the values' "$line_mainnet"$'\n\nA summary.\n' --tag v2.7.0 --mainnet required \ + --mainnet-block ' 3300000 ' --mainnet-time ' 2026-12-10 12:00 UTC ' --summary ' A summary. ' +accepts 'a summary of spaces is no summary' "$line_optional"$'\n' --tag v2.7.0 --summary ' ' +accepts 'empty blocks and times on optional networks' "$line_optional"$'\n' --tag v2.7.0 \ + --mainnet-block '' --mainnet-time '' --testnet-block ' ' --testnet-time '' +accepts 'markup in the summary is kept' "$line_optional"$'\n\n**Note:** see [the guide](https://example.test).\n' \ + --tag v2.7.0 --summary '**Note:** see [the guide](https://example.test).' + +# The tag. +refuses 'no tag' 'The tag is missing.' +refuses 'empty tag' 'The tag is missing.' --tag '' +for bad in 2.7.0 v2.7 v2.7.0.1 v2.7.0-rc.1 v02.7.0 v2.07.0 v2.7.01 V2.7.0 'v2.7.0 ' ' v2.7.0' 'v2.7.0/x'; do + refuses "tag '$bad'" "The tag '$bad' is not of the form vX.Y.Z" --tag "$bad" +done +refuses 'tag with a new line' "The tag 'v2.7.0?x' is not of the form vX.Y.Z" --tag $'v2.7.0\nx' + +# The target. +refuses 'empty target' 'The target is empty.' --tag v2.7.0 --target '' +for bad in ../x main..x -x /x x/ a//b 'a b' 'main?x' 'main#x' 'main~1' 'main^'; do + refuses "target '$bad'" "The target '$bad' is not a branch name or a commit." --tag v2.7.0 --target "$bad" +done + +# The choices. +for net in mainnet testnet; do + for bad in Required yes ''; do + refuses "$net choice '$bad'" "The $net choice is '$bad'; it is optional or required." --tag v2.7.0 --$net "$bad" + done +done +refuses "short notice 'yes'" "Short notice is 'yes'; it is true or false." --tag v2.7.0 --short-notice yes + +# A required network needs its block and its time. +refuses 'mainnet required, no block' 'Mainnet is required, so give the mainnet block' \ + --tag v2.7.0 --mainnet required --mainnet-time '2026-12-10 12:00' +refuses 'mainnet required, no time' 'Mainnet is required, so give the time of the mainnet block' \ + --tag v2.7.0 --mainnet required --mainnet-block 3300000 +refuses 'testnet required, no block' 'Testnet is required, so give the testnet block' \ + --tag v2.7.0 --testnet required --testnet-time '2026-12-03 12:00' +refuses 'testnet required, no time' 'Testnet is required, so give the time of the testnet block' \ + --tag v2.7.0 --testnet required --testnet-block 16300000 +refuses 'testnet required, block of spaces' 'Testnet is required, so give the testnet block' \ + --tag v2.7.0 --testnet required --testnet-block ' ' --testnet-time '2026-12-03 12:00' + +# An optional network takes no block and no time, so nothing typed is dropped. +refuses 'stray mainnet block' "The mainnet block is '3300000', but mainnet is optional." --tag v2.7.0 --mainnet-block 3300000 +refuses 'stray mainnet time' "The mainnet time is '2026-12-10 12:00', but mainnet is optional." --tag v2.7.0 --mainnet-time '2026-12-10 12:00' +refuses 'stray testnet block' "The testnet block is '16300000', but testnet is optional." --tag v2.7.0 --testnet-block 16300000 +refuses 'stray testnet time' "The testnet time is '2026-12-03 12:00', but testnet is optional." --tag v2.7.0 --testnet-time '2026-12-03 12:00' +refuses 'stray testnet block, mainnet required' "The testnet block is '16300000', but testnet is optional." \ + --tag v2.7.0 "${mainnet[@]}" --testnet-block 16300000 + +# Blocks. +for bad in 0 03300000 3,300,000 3.3e6 3_300_000 '3300000 blocks' abc -5; do + refuses "block '$bad'" "The mainnet block '$bad' is not a block height." \ + --tag v2.7.0 --mainnet required --mainnet-block "$bad" --mainnet-time '2026-12-10 12:00' +done + +# Times. +for bad in '2026-12-10T12:00Z' '2026-12-10 12:00:00' '2026-12-10 9:00' '2026-12-10 12' '10-12-2026 12:00' \ + '2026/12/10 12:00' '2026-12-10 12:00 utc' '2026-13-10 12:00' '2026-00-10 12:00' '2026-12-32 12:00' \ + '2026-12-00 12:00' '2026-11-31 12:00' '2026-12-10 24:00' '2026-12-10 12:60' '2027-02-29 12:00' \ + '2100-02-29 12:00' 'next week'; do + refuses "time '$bad'" "The testnet time '$bad' is not a UTC time of the form YYYY-MM-DD HH:MM" \ + --tag v2.7.0 --testnet required --testnet-block 16300000 --testnet-time "$bad" +done +accepts 'leap day 2000-02-29' 'Upgrade: optional on mainnet, required on testnet from block 16300000 (about 2000-02-29 12:00 UTC).'$'\n' \ + --now '2000-01-01 00:00' --tag v2.7.0 --testnet required --testnet-block 16300000 --testnet-time '2000-02-29 12:00' +accepts 'leap day 2028-02-29' 'Upgrade: optional on mainnet, required on testnet from block 16300000 (about 2028-02-29 12:00 UTC).'$'\n' \ + --tag v2.7.0 --testnet required --testnet-block 16300000 --testnet-time '2028-02-29 12:00' + +# At least 7 days of notice on mainnet, counted from now. +refuses 'mainnet time 6 days away' \ + 'The mainnet time 2026-12-01 12:00 UTC is less than 7 days away. A required release goes out at least 7 days before its mainnet block, so pick a block at 2026-12-02 12:00 UTC or later, or tick short notice for an urgent release.' \ + --tag v2.7.0 --mainnet required --mainnet-block 3300000 --mainnet-time '2026-12-01 12:00' +refuses 'mainnet time in the past' 'The mainnet time 2026-11-20 12:00 UTC is less than 7 days away.' \ + --tag v2.7.0 --mainnet required --mainnet-block 3300000 --mainnet-time '2026-11-20 12:00' +# The boundary, across a month, a year end, and February in a leap and a common year. +for pair in '2026-11-25 12:00=2026-12-02' '2026-12-28 12:00=2027-01-04' '2028-02-25 12:00=2028-03-03' '2027-02-25 12:00=2027-03-04'; do + start=${pair%=*} day=${pair#*=} + accepts "exactly 7 days after $start" "Upgrade: required on mainnet from block 3300000 (about $day 12:00 UTC), optional on testnet."$'\n' \ + --now "$start" --tag v2.7.0 --mainnet required --mainnet-block 3300000 --mainnet-time "$day 12:00" + refuses "a minute short of 7 days after $start" "The mainnet time $day 11:59 UTC is less than 7 days away." \ + --now "$start" --tag v2.7.0 --mainnet required --mainnet-block 3300000 --mainnet-time "$day 11:59" +done +# Testnet has no notice rule. +accepts 'testnet time 1 day away' 'Upgrade: optional on mainnet, required on testnet from block 16300000 (about 2026-11-26 12:00 UTC).'$'\n' \ + --tag v2.7.0 --testnet required --testnet-block 16300000 --testnet-time '2026-11-26 12:00' + +# Short notice lets a nearer mainnet time through, with a warning. +warns 'short notice' warning 'The mainnet time 2026-11-28 12:00 UTC is less than 7 days away. Short notice is ticked, so the draft goes ahead' \ + --tag v2.7.0 --mainnet required --mainnet-block 3300000 --mainnet-time '2026-11-28 12:00' --short-notice true +is 'short notice: notes' "$out" $'Upgrade: required on mainnet from block 3300000 (about 2026-11-28 12:00 UTC), optional on testnet.\n' +warns 'short notice, time passed' warning 'The mainnet time 2026-11-24 12:00 UTC has passed. Short notice is ticked, so the draft goes ahead' \ + --tag v2.7.0 --mainnet required --mainnet-block 3300000 --mainnet-time '2026-11-24 12:00' --short-notice true +warns 'short notice not needed' notice 'Short notice is ticked, but the mainnet time is 7 days away or more, so it changes nothing.' \ + --tag v2.7.0 "${mainnet[@]}" --short-notice true +warns 'short notice, mainnet optional' notice 'Short notice is ticked, but mainnet is not required, so it changes nothing.' \ + --tag v2.7.0 "${testnet[@]}" --short-notice true +warns 'testnet time passed' warning 'The testnet time 2026-11-24 12:00 UTC has passed.' \ + --tag v2.7.0 --testnet required --testnet-block 16300000 --testnet-time '2026-11-24 12:00' +refuses 'short notice does not let a bad time through' "The mainnet time '2026-11-28' is not a UTC time" \ + --tag v2.7.0 --mainnet required --mainnet-block 3300000 --mainnet-time '2026-11-28' --short-notice true + +# Every problem prints, in one run. +run --tag v2.7 --target ../x --mainnet required --mainnet-time '2026-11-28 12:00' \ + --testnet-block 16300000 --summary $'two\nlines' --short-notice maybe +is 'many problems: exit' "$status" 1 +is 'many problems: prints nothing' "$out" "" +for part in "The tag 'v2.7'" "The target '../x'" "Short notice is 'maybe'" 'The summary must be one line' \ + 'Mainnet is required, so give the mainnet block' 'The mainnet time 2026-11-28 12:00 UTC is less than 7 days away' \ + "The testnet block is '16300000', but testnet is optional" 'The form has 7 problem(s).'; do + has "many problems: $part" "$err" "$part" +done +refuses 'a summary of two lines' 'The summary must be one line of text.' --tag v2.7.0 --summary $'two\nlines' +refuses 'a summary with a carriage return' 'The summary must be one line of text.' --tag v2.7.0 --summary $'one\rtwo' + +# In Actions, problems are annotations. +settings=(GITHUB_ACTIONS=true) +run --tag v2.7 +has 'Actions: error annotation' "$err" "::error::The tag 'v2.7' is not of the form vX.Y.Z" +run --tag v2.7.0 --mainnet required --mainnet-block 3300000 --mainnet-time '2026-11-28 12:00' --short-notice true +has 'Actions: warning annotation' "$err" '::warning::The mainnet time 2026-11-28 12:00 UTC is less than 7 days away.' +settings=() + +# The height check reads each required network's height and only warns. +rpc=(--mainnet-rpc https://rpc.mainnet.example/rpc/v1 --testnet-rpc https://rpc.testnet.example/rpc/v1) +reply() { printf '{"jsonrpc":"2.0","id":1,"result":{"chain_id":"x","block_height":%s,"block_hash":"ab","gas":false}}' "$1"; } +settings=(FAKE_MAINNET="$(reply 3235250)" FAKE_TESTNET="$(reply 16169260)") +accepts 'blocks above the heights' "$line_both"$'\n' --tag v2.7.0 "${mainnet[@]}" "${testnet[@]}" "${rpc[@]}" +has 'height read: JSON-RPC method' "$(cat "$tmp/curl-argv")" '"method":"user.chain_info"' +has 'height read: mainnet URL' "$(cat "$tmp/curl-argv")" 'https://rpc.mainnet.example/rpc/v1' +has 'height read: testnet URL' "$(cat "$tmp/curl-argv")" 'https://rpc.testnet.example/rpc/v1' +settings=(FAKE_MAINNET="$(reply 3300000)" FAKE_TESTNET="$(reply 16400000)") +warns 'mainnet block at the height' warning 'The mainnet block 3300000 is not above the current mainnet height 3300000, read from https://rpc.mainnet.example/rpc/v1.' \ + --tag v2.7.0 "${mainnet[@]}" "${testnet[@]}" "${rpc[@]}" +has 'testnet block below the height' "$err" 'warning: The testnet block 16300000 is not above the current testnet height 16400000' +settings=(FAKE_MAINNET="$(reply 9999999)") +accepts 'a block with more digits than the height' 'Upgrade: required on mainnet from block 10000000 (about 2026-12-10 12:00 UTC), optional on testnet.'$'\n' \ + --tag v2.7.0 --mainnet required --mainnet-block 10000000 --mainnet-time '2026-12-10 12:00' "${rpc[@]}" +settings=(FAKE_MAINNET="$(reply 10000000)") +warns 'a block with fewer digits than the height' warning 'The mainnet block 9999999 is not above the current mainnet height 10000000' \ + --tag v2.7.0 --mainnet required --mainnet-block 9999999 --mainnet-time '2026-12-10 12:00' "${rpc[@]}" +settings=() +warns 'unreachable node' notice 'Could not read the current mainnet height from https://rpc.mainnet.example/rpc/v1, so the mainnet block is not compared with it.' \ + --tag v2.7.0 "${mainnet[@]}" "${rpc[@]}" +settings=(FAKE_MAINNET='502 Bad Gateway') +warns 'an answer without a height' notice 'Could not read the current mainnet height' --tag v2.7.0 "${mainnet[@]}" "${rpc[@]}" +settings=(FAKE_MAINNET="$(reply 3235250)") +run --tag v2.7.0 "${testnet[@]}" --mainnet-rpc https://rpc.mainnet.example/rpc/v1 +is 'optional network: height not read' "$(cat "$tmp/curl-argv" 2>/dev/null)" "" +run --tag v2.7.0 "${mainnet[@]}" +is 'no URL: height not read' "$(cat "$tmp/curl-argv" 2>/dev/null)" "" +run --tag v2.7.0 --mainnet required --mainnet-block 3,300,000 --mainnet-time '2026-12-10 12:00' "${rpc[@]}" +is 'bad block: height not read' "$(cat "$tmp/curl-argv" 2>/dev/null)" "" +settings=() + +# Wrong arguments. +for args in '--bogus 1' '--tag' 'v2.7.0' '-- v2.7.0' '--tag v2.7.0 extra' '--now 2026-11-25'; do + read -r -a argv <<<"$args" + run "${argv[@]}" + is "arguments '$args': exit" "$status" 2 + has "arguments '$args': usage" "$err" 'usage:' +done + +if [ "$fails" -ne 0 ]; then + echo "$fails check(s) failed" + exit 1 +fi +echo "all checks passed" From d32c104130c78721defcc64b7a1822f88ce817a5 Mon Sep 17 00:00:00 2001 From: Michael Buntarman Date: Wed, 25 Nov 2026 20:00:53 +0700 Subject: [PATCH 2/3] ci(release): draft the exact commit you ran the form on --- .github/workflows/draft-release.yaml | 16 +++++++++++++--- docs/release-process.md | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/draft-release.yaml b/.github/workflows/draft-release.yaml index 9a15bc7b..090e6789 100644 --- a/.github/workflows/draft-release.yaml +++ b/.github/workflows/draft-release.yaml @@ -129,7 +129,11 @@ jobs: echo "::error::A release or a draft for $TAG exists already. Finish or delete it on the releases page, or pick a new tag." exit 1 fi - if ! sha=$(gh api "repos/$GITHUB_REPOSITORY/commits/$TARGET" --jq .sha); then + if [ "$TARGET" = "$GITHUB_REF_NAME" ]; then + # The branch or tag the run was started from: its commit when Run + # workflow was clicked. + sha=$GITHUB_SHA + elif ! sha=$(gh api "repos/$GITHUB_REPOSITORY/commits/$TARGET" --jq .sha); then echo "::error::The target $TARGET is not a branch, tag or commit of this repository." exit 1 fi @@ -152,8 +156,14 @@ jobs: env: SHA: ${{ steps.target.outputs.sha }} run: | - url=$(gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --draft \ - --title "$TAG" --target "$SHA" --notes-file "$RUNNER_TEMP/body.md") + if ! url=$(gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --draft \ + --title "$TAG" --target "$SHA" --notes-file "$RUNNER_TEMP/body.md"); then + # GitHub asks for the workflows permission, which GITHUB_TOKEN + # cannot have, to release a commit that changes a workflow file and + # is not the tip of a branch or a tag. + echo "::error::GitHub refused the draft, and nothing was created. If commit $SHA changes a file under .github/workflows and is no longer the tip of a branch or a tag (for example, the branch moved on during the run), GitHub does not let this workflow release it. Run the form again with a branch whose tip is the commit to release, or write the release by hand (docs/release-process.md)." + exit 1 + fi echo "Draft release: $url" echo "url=$url" >> "$GITHUB_OUTPUT" diff --git a/docs/release-process.md b/docs/release-process.md index 02d562a2..916f0192 100644 --- a/docs/release-process.md +++ b/docs/release-process.md @@ -99,7 +99,7 @@ The normal way is the **Draft release** form. It writes the upgrade line, adds t 1. On the repository's **Actions** tab, choose **Draft release**, then **Run workflow**. Leave **Use workflow from** on `main`. 2. Fill in the form: - **Tag**: the new release's tag, `vX.Y.Z`. No release, draft or tag may have it yet. - - **Target**: the branch or commit to release, `main` by default. The draft is pinned to the commit that the target points at when the run starts, so a later merge does not slip into the release. + - **Target**: the branch or commit to release, `main` by default. The draft is pinned to one commit, so a later merge does not slip into the release. When the target is the branch in **Use workflow from**, as `main` is by default, that commit is the branch's tip when you click **Run workflow**. For another target, it is the commit the target points at when the run checks it, shortly after the start. GitHub does not let the run release a commit that changes a file under `.github/workflows` and is not the tip of a branch or a tag; the run then stops with an error and creates nothing. Give a branch whose tip is that commit as the target, or release [by hand](#by-hand). - **Mainnet** and **Testnet**: `optional` or `required`; see [Optional or Required](#optional-or-required). - For each required network, its **block** and its **time**, in UTC as `YYYY-MM-DD HH:MM`; see [Notice for a Required Release](#notice-for-a-required-release). Leave both empty for an optional network. The run refuses a block or a time given for an optional network, so that nothing you typed is dropped. - **Summary**: optional. One line shown under the upgrade line, above the generated notes. From 3da3f6c103a88ec8e5ffe1add9261650db1e2a07 Mon Sep 17 00:00:00 2001 From: Michael Buntarman Date: Wed, 25 Nov 2026 20:07:59 +0700 Subject: [PATCH 3/3] ci(release): see whether a failed draft run left a draft behind --- .github/workflows/draft-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/draft-release.yaml b/.github/workflows/draft-release.yaml index 090e6789..d9ec6f86 100644 --- a/.github/workflows/draft-release.yaml +++ b/.github/workflows/draft-release.yaml @@ -161,7 +161,7 @@ jobs: # GitHub asks for the workflows permission, which GITHUB_TOKEN # cannot have, to release a commit that changes a workflow file and # is not the tip of a branch or a tag. - echo "::error::GitHub refused the draft, and nothing was created. If commit $SHA changes a file under .github/workflows and is no longer the tip of a branch or a tag (for example, the branch moved on during the run), GitHub does not let this workflow release it. Run the form again with a branch whose tip is the commit to release, or write the release by hand (docs/release-process.md)." + echo "::error::The draft could not be created, or its creation could not be confirmed. Before running the form again, check the releases page for a draft of $TAG, and publish or delete it if it is there. If commit $SHA changes a file under .github/workflows and is no longer the tip of a branch or a tag (for example, the branch moved on during the run), GitHub does not let this workflow release it. Run the form again with a branch whose tip is the commit to release, or write the release by hand (docs/release-process.md)." exit 1 fi echo "Draft release: $url"