Skip to content

Commit 08869cd

Browse files
committed
Fix release script
1 parent 68a5352 commit 08869cd

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

apps/cli/scripts/release.sh

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,30 @@ create_release() {
401401
step "8/8" "Creating GitHub release..."
402402
cd "$REPO_ROOT"
403403

404+
# Get the current commit SHA for the release target
405+
COMMIT_SHA=$(git rev-parse HEAD)
406+
407+
# Verify the commit exists on GitHub before attempting to create the release
408+
# This prevents the "Release.target_commitish is invalid" error
409+
info "Verifying commit ${COMMIT_SHA:0:8} exists on GitHub..."
410+
git fetch origin 2>/dev/null || true
411+
if ! git branch -r --contains "$COMMIT_SHA" 2>/dev/null | grep -q "origin/"; then
412+
warn "Commit ${COMMIT_SHA:0:8} has not been pushed to GitHub"
413+
echo ""
414+
echo "The release script needs to create a release at your current commit,"
415+
echo "but this commit hasn't been pushed to GitHub yet."
416+
echo ""
417+
read -p "Push current branch to origin now? [Y/n] " -n 1 -r
418+
echo
419+
if [[ ! $REPLY =~ ^[Nn]$ ]]; then
420+
info "Pushing to origin..."
421+
git push origin HEAD || error "Failed to push to origin. Please push manually and try again."
422+
else
423+
error "Aborted. Please push your commits to GitHub and try again."
424+
fi
425+
fi
426+
info "Commit verified on GitHub"
427+
404428
# Build the What's New section from changelog content
405429
WHATS_NEW_SECTION=""
406430
if [ -n "$CHANGELOG_CONTENT" ]; then
@@ -456,8 +480,6 @@ $(cat "${TARBALL}.sha256" 2>/dev/null || echo "N/A")
456480
EOF
457481
)
458482

459-
# Get the current commit SHA for the release target
460-
COMMIT_SHA=$(git rev-parse HEAD)
461483
info "Creating release at commit: ${COMMIT_SHA:0:8}"
462484

463485
# Create release (gh will create the tag automatically)

0 commit comments

Comments
 (0)