Skip to content

Commit 4ea412e

Browse files
committed
feat: add explicit push commands and update npm commit message in release script
1 parent 8592dd1 commit 4ea412e

File tree

2 files changed

+86
-4
lines changed

2 files changed

+86
-4
lines changed

scripts/release.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,7 @@ commit_npm_package_update() {
164164
git add npm/package.json
165165
git commit -m "chore: update npm package to v$version"
166166

167-
# If cargo-release has already pushed commits, we need to push our npm update too
168-
git push origin main
169-
170-
print_success "Committed and pushed npm/package.json update"
167+
print_success "Committed npm/package.json update (will be pushed with other changes)"
171168
}
172169

173170
load_env_file() {
@@ -547,6 +544,21 @@ main() {
547544
commit_npm_package_update "$released_version"
548545
fi
549546

547+
# Explicitly push commits and tags to ensure they are properly synchronized
548+
print_info "Pushing commits and tags to remote..."
549+
if [[ "$dry_run" != 'true' ]]; then
550+
# Push commits to main branch
551+
git push origin main
552+
553+
# Push tags (cargo-release with push=true should have created the tag,
554+
# but we explicitly push to make sure)
555+
git push --tags origin
556+
557+
print_success "Commits and tags pushed successfully"
558+
else
559+
print_info "Dry run - would push commits and tags"
560+
fi
561+
550562
if [[ "$skip_crates" == 'false' ]]; then
551563
print_info 'Waiting for crates.io to propagate...'
552564
sleep 10
@@ -569,6 +581,7 @@ main() {
569581

570582
print_success 'Release process finished'
571583
print_info "GitHub Release should now contain changelog notes generated by cargo-release"
584+
print_info "All commits, tags, and releases have been pushed to the remote repository"
572585
}
573586

574587
main "$@"

scripts/test-release-push.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env bash
2+
3+
# Test script to verify the release script changes work as expected
4+
# This script simulates the key operations without actually making changes
5+
6+
set -euo pipefail
7+
8+
RED='\033[0;31m'
9+
GREEN='\033[0;32m'
10+
YELLOW='\033[1;33m'
11+
BLUE='\033[0;34m'
12+
NC='\033[0m'
13+
14+
print_info() {
15+
printf '%b\n' "${BLUE}INFO:${NC} $1"
16+
}
17+
18+
print_success() {
19+
printf '%b\n' "${GREEN}SUCCESS:${NC} $1"
20+
}
21+
22+
print_warning() {
23+
printf '%b\n' "${YELLOW}WARNING:${NC} $1"
24+
}
25+
26+
print_error() {
27+
printf '%b\n' "${RED}ERROR:${NC} $1"
28+
}
29+
30+
print_info "Testing the updated release script functionality..."
31+
32+
print_info "1. Checking if release script has the required changes..."
33+
if grep -q "Pushing commits and tags to remote" scripts/release.sh; then
34+
print_success "✓ Found explicit push commands in release script"
35+
else
36+
print_error "✗ Missing explicit push commands in release script"
37+
fi
38+
39+
if grep -q "git push origin main" scripts/release.sh; then
40+
print_success "✓ Found git push origin main command"
41+
else
42+
print_error "✗ Missing git push origin main command"
43+
fi
44+
45+
if grep -q "git push --tags origin" scripts/release.sh; then
46+
print_success "✓ Found git push --tags origin command"
47+
else
48+
print_error "✗ Missing git push --tags origin command"
49+
fi
50+
51+
if grep -q "will be pushed with other changes" scripts/release.sh; then
52+
print_success "✓ Found updated npm commit message"
53+
else
54+
print_error "✗ Missing updated npm commit message"
55+
fi
56+
57+
if grep -q "All commits, tags, and releases have been pushed" scripts/release.sh; then
58+
print_success "✓ Found final status message"
59+
else
60+
print_error "✗ Missing final status message"
61+
fi
62+
63+
print_info ""
64+
print_info "The updated release script changes are in place:"
65+
print_info " - Explicit git push commands for commits and tags"
66+
print_info " - Updated npm package commit message"
67+
print_info " - Final status message confirming all pushes"
68+
print_info ""
69+
print_success "Test completed - Release script updates are properly implemented"

0 commit comments

Comments
 (0)