Skip to content

Commit 2c806db

Browse files
authored
feat: guard release against non-main and stale branches (#358)
1 parent e6b5db3 commit 2c806db

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Justfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ build GOOS=(GOOS) GOARCH=(GOARCH):
5555
release:
5656
#!/usr/bin/env bash
5757
set -euo pipefail
58+
branch="$(git rev-parse --abbrev-ref HEAD)"
59+
if [ "${branch}" != "main" ]; then
60+
echo "Releases must be tagged on main, not ${branch}"; exit 1
61+
fi
62+
git fetch origin main
63+
if [ "$(git rev-parse HEAD)" != "$(git rev-parse origin/main)" ]; then
64+
echo "Local main is not up to date with origin/main"; exit 1
65+
fi
5866
next="$(svu next)"
5967
if [ "${next}" = "$(svu current 2>/dev/null)" ]; then
6068
echo "No releasable changes since ${next}"; exit 1

0 commit comments

Comments
 (0)