Skip to content

Commit b08d9e8

Browse files
committed
chore: update tag-release to verify commit was signed off
1 parent f28ac16 commit b08d9e8

1 file changed

Lines changed: 36 additions & 6 deletions

File tree

scripts/tag-release.sh

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ if [[ "$current_branch" != "main" ]]; then
4444
fi
4545
fi
4646

47-
# Fetch latest tags
48-
echo "Fetching latest tags..."
49-
git fetch --tags
47+
# Fetch latest from origin (main branch and tags)
48+
echo "Fetching latest from origin..."
49+
git fetch origin main --tags
5050

5151
# Get the latest tag
5252
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
@@ -88,10 +88,40 @@ if git rev-parse "$new_version" >/dev/null 2>&1; then
8888
exit 1
8989
fi
9090

91+
# Verify the commit has been signed off
92+
echo ""
93+
echo "Verifying commit signoff..."
94+
COMMIT_SHA=$(git rev-parse origin/main)
95+
SIGNOFF_STATUS=$(gh api \
96+
-H "Accept: application/vnd.github+json" \
97+
-H "X-GitHub-Api-Version: 2022-11-28" \
98+
"/repos/sequinstream/sequin/commits/$COMMIT_SHA/statuses" 2>/dev/null || echo "[]")
99+
100+
SIGNOFF_SUCCESS=$(echo "$SIGNOFF_STATUS" | jq '[.[] | select(.context=="signoff" and .state=="success")] | length')
101+
SIGNOFF_PENDING=$(echo "$SIGNOFF_STATUS" | jq '[.[] | select(.context=="signoff" and .state=="pending")] | length')
102+
103+
if [ "$SIGNOFF_SUCCESS" -gt 0 ]; then
104+
echo -e "${GREEN}✓ Commit has been signed off${RESET}"
105+
elif [ "$SIGNOFF_PENDING" -gt 0 ]; then
106+
echo -e "${YELLOW}⏳ Signoff is still running. Please wait for it to complete.${RESET}"
107+
echo " Check status at: https://github.com/sequinstream/sequin/commit/$COMMIT_SHA"
108+
exit 1
109+
else
110+
echo -e "${RED}✗ Commit has not been signed off.${RESET}"
111+
echo ""
112+
echo "This could mean:"
113+
echo " 1. The signoff workflow hasn't started yet (wait a moment)"
114+
echo " 2. The signoff workflow failed (check GitHub Actions)"
115+
echo " 3. This commit was never pushed to main"
116+
echo ""
117+
echo "Check status at: https://github.com/sequinstream/sequin/commit/$COMMIT_SHA"
118+
exit 1
119+
fi
120+
91121
# Show what will happen
92122
echo ""
93123
echo -e "${CYAN}This will:${RESET}"
94-
echo " 1. Create tag $new_version on commit $(git rev-parse --short HEAD)"
124+
echo " 1. Create tag $new_version on commit $(git rev-parse --short origin/main) (origin/main)"
95125
echo " 2. Push the tag to GitHub"
96126
echo " 3. Trigger the GitHub Actions release workflow"
97127
echo ""
@@ -111,8 +141,8 @@ fi
111141

112142
# Create and push the tag
113143
echo ""
114-
echo "Creating tag $new_version..."
115-
git tag "$new_version"
144+
echo "Creating tag $new_version on origin/main..."
145+
git tag "$new_version" origin/main
116146

117147
echo "Pushing tag to GitHub..."
118148
git push origin "$new_version"

0 commit comments

Comments
 (0)