From 915909cf6bee3306e069e55cda90d4bac862183a Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 3 Dec 2026 11:33:57 -0800 Subject: [PATCH] ci: refuse a block release without notes before pushing images The notes file was first checked in the last step, after both images (and, for the highest stable tag, :alpha) were already pushed to GHCR, so a tag without docs/releases/vX.Y.Z.md left the images published and no GitHub release. Check it with the tag format, before anything is pushed. Co-Authored-By: Claude Opus 5.5 --- .github/block/scripts/block-ci-port-test.py | 1 + .github/workflows/block-release.yml | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/block/scripts/block-ci-port-test.py b/.github/block/scripts/block-ci-port-test.py index ea35dc60b8..36f0c68dc4 100644 --- a/.github/block/scripts/block-ci-port-test.py +++ b/.github/block/scripts/block-ci-port-test.py @@ -57,6 +57,7 @@ class PortTests(unittest.TestCase): self.assertNotIn("BLOCK_RUNNER_LABEL", text) self.assertIn('sw-block-${version}-linux-amd64.tar.gz', text) self.assertNotIn("go build", text) + self.assertLess(text.index("refusing to publish: release notes"), text.index("docker/build-push-action")) for name in ("sw-block", "blockcsi"): recipe = (ROOT / (".github/dockerfiles/block-" + name + ".Dockerfile")).read_text() self.assertIn("WORKDIR /src/seaweed-block", recipe) diff --git a/.github/workflows/block-release.yml b/.github/workflows/block-release.yml index f463df3d38..1a697fc4a1 100644 --- a/.github/workflows/block-release.yml +++ b/.github/workflows/block-release.yml @@ -50,6 +50,12 @@ jobs: echo "refusing to publish: tag ${version} is not vX.Y.Z or vX.Y.Z-pre" >&2 exit 1 fi + notes="seaweed-block/docs/releases/${version%%-*}.md" + if [[ ! -s "${notes}" ]]; then + echo "refusing to publish: release notes ${notes} are missing or empty" >&2 + exit 1 + fi + echo "notes=${notes}" >> "$GITHUB_OUTPUT" stable=false move_alpha=false if [[ "${version}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then @@ -95,12 +101,11 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BLOCK_DIGEST: ${{ steps.block.outputs.digest }} + NOTES: ${{ steps.tags.outputs.notes }} shell: bash run: | set -euo pipefail version="${GITHUB_REF_NAME#seaweed-block/}" - notes="seaweed-block/docs/releases/${version%%-*}.md" - test -s "$notes" out="$RUNNER_TEMP/block-release" mkdir -p "$out/bin" docker pull "${BLOCK_IMAGE}@${BLOCK_DIGEST}" @@ -113,6 +118,6 @@ jobs: asset="sw-block-${version}-linux-amd64.tar.gz" tar -C "$out/bin" -czf "$out/$asset" blockmaster blockvolume sw-block (cd "$out" && sha256sum "$asset" >SHA256SUMS) - args=(--repo "$GITHUB_REPOSITORY" --verify-tag --latest=false --title "Seaweed Block $version" --notes-file "$notes") + args=(--repo "$GITHUB_REPOSITORY" --verify-tag --latest=false --title "Seaweed Block $version" --notes-file "$NOTES") if [[ "$version" == *-* ]]; then args+=(--prerelease); fi gh release create "$GITHUB_REF_NAME" "$out/$asset" "$out/SHA256SUMS" "${args[@]}"