Skip to content

Commit 12a303d

Browse files
adriencacciaclaude
andcommitted
feat: fail release script if version already exists
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 6e1e277 commit 12a303d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

scripts/release.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ if ! [[ "$NEW_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
3535
fi
3636
MAJOR_VERSION=$(echo "$NEW_VERSION" | cut -d. -f1)
3737

38+
# Check if this version has already been released (local tag, remote tag, or GitHub release)
39+
if git tag -l "v$NEW_VERSION" | grep -q . || git ls-remote --tags origin "refs/tags/v$NEW_VERSION" | grep -q . || gh release view "v$NEW_VERSION" > /dev/null 2>&1; then
40+
echo "Error: v$NEW_VERSION has already been released."
41+
exit 1
42+
fi
43+
3844
# Determine release notes strategy
3945
RUNNER_NOTES=$(gh release view "v$NEW_VERSION" -R CodSpeedHQ/codspeed --json body | jq -r .body)
4046
RELEASE_NOTES="$RUNNER_NOTES

0 commit comments

Comments
 (0)