mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
fef4dbaaac
commit
915909cf6b
2 files changed
+9
-3
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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[@]}"
|
||||
Reference in new issue
Block a user