Repository navigation
Expand file tree
/
Copy pathrelease.sh
More file actions
560 lines (499 loc) · 21.2 KB
/
Copy pathrelease.sh
File metadata and controls
560 lines (499 loc) · 21.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
#!/bin/bash
# Interactive release script for Rust crates (crates.io)
# Usage: ./release.sh [--yes|-y] [version]
# Example: ./release.sh 0.1.0
# ./release.sh --yes # silent mode, auto-accept defaults
# ./release.sh --yes 0.1.0 # silent mode with specific version
#
# Auto-detects project name from Cargo.toml and GitHub repo from git remote.
# Override with environment variables: PROJECT_NAME, GITHUB_REPO,
# GITHUB_ACCOUNT (gh login that publishes the GitHub release),
# TAG_PREFIX (default: git subdirectory prefix or "rust"), RELEASE_TITLE
# (default: "${PROJECT_NAME} (Rust) v${VERSION}").
SILENT=false
GITHUB_ACCOUNT="${GITHUB_ACCOUNT:-}"
POSITIONAL_ARGS=()
while [ "$#" -gt 0 ]; do
case "$1" in
--yes|-y) SILENT=true ;;
--account|-a)
if [ "$#" -lt 2 ] || [ -z "$2" ]; then
echo "Error: --account needs a GitHub login" >&2
exit 1
fi
GITHUB_ACCOUNT="$2"
shift
;;
--account=*) GITHUB_ACCOUNT="${1#*=}" ;;
*) POSITIONAL_ARGS+=("$1") ;;
esac
shift
done
set -- "${POSITIONAL_ARGS[@]}"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m'
# Auto-detect project name from Cargo.toml
if [ -z "$PROJECT_NAME" ]; then
PROJECT_NAME=$(grep -E '^name = ' Cargo.toml | head -1 | sed 's/name = "\(.*\)"/\1/')
if [ -z "$PROJECT_NAME" ]; then
echo -e "${RED}Error: Could not determine project name from Cargo.toml${NC}"
exit 1
fi
fi
# Auto-detect GitHub repo from git remote
if [ -z "$GITHUB_REPO" ]; then
REMOTE_URL=$(git remote get-url origin 2>/dev/null)
if [ -n "$REMOTE_URL" ]; then
# Covers SSH aliases such as git@github-work:owner/repo.git, not only
# a literal github.com prefix.
GITHUB_REPO=$(echo "$REMOTE_URL" \
| sed -E 's|\.git$||; s|/+$||' \
| tr ':' '/' \
| awk -F/ '{ if (NF >= 2) print $(NF-1) "/" $NF }')
if ! echo "$GITHUB_REPO" | grep -Eq '^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$'; then
echo -e "${YELLOW}Warning: could not parse owner/repo from ${REMOTE_URL}${NC}"
echo -e "${YELLOW} Set GITHUB_REPO=owner/repo to create the GitHub release${NC}"
GITHUB_REPO=""
fi
fi
if [ -z "$GITHUB_REPO" ]; then
echo -e "${YELLOW}Warning: Could not detect GitHub repo from git remote${NC}"
fi
fi
# GitHub account: --account, then GITHUB_ACCOUNT, then Cargo.toml
# [package.metadata.apdev] github_account, then whatever `gh` has active. When
# set, its token is exported for this run only, so `gh` acts as that user
# without touching the global `gh auth switch` state.
if [ -z "$GITHUB_ACCOUNT" ] && [ -f Cargo.toml ]; then
GITHUB_ACCOUNT=$(awk '
/^[[:space:]]*\[/ {
in_meta = ($0 ~ /^[[:space:]]*\[package\.metadata\.apdev\][[:space:]]*$/)
next
}
in_meta && /^[[:space:]]*github_account[[:space:]]*=/ {
print
exit
}
' Cargo.toml | sed -E 's/^[^=]*=[[:space:]]*//; s/[[:space:]]+$//; s/^"//; s/"$//')
fi
if [ -n "$GITHUB_ACCOUNT" ]; then
if ! command -v gh > /dev/null 2>&1; then
echo -e "${RED}Error: GITHUB_ACCOUNT needs the GitHub CLI${NC}"
echo -e "${YELLOW}Install it (brew install gh) or unset the account to use the active login${NC}"
exit 1
fi
if ! GH_ACCOUNT_TOKEN=$(gh auth token --user "$GITHUB_ACCOUNT" 2>/dev/null) || [ -z "$GH_ACCOUNT_TOKEN" ]; then
echo -e "${RED}Error: GitHub account '${GITHUB_ACCOUNT}' is not logged in${NC}"
echo -e "${YELLOW}Add it once with: gh auth login --git-protocol ssh${NC}"
echo -e "${YELLOW}Then verify with: gh auth status${NC}"
exit 1
fi
GH_TOKEN="$GH_ACCOUNT_TOKEN"
GITHUB_TOKEN="$GH_ACCOUNT_TOKEN"
export GH_TOKEN GITHUB_TOKEN
fi
# Get version from argument or Cargo.toml
if [ -z "$1" ]; then
VERSION=$(grep -E '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
if [ -z "$VERSION" ]; then
echo -e "${RED}Error: Could not determine version from Cargo.toml${NC}"
exit 1
fi
else
VERSION="$1"
fi
# Tag prefix: TAG_PREFIX env (even if empty, for bare "vX.Y.Z" tags), then
# Cargo.toml [package.metadata.apdev] tag_prefix, then the crate's relative
# path from the git root (e.g. "rust" in apcore/apdev, "mcp/rust" in
# apcore-surfaces), falling back to "rust" at the repo root (e.g. apexe).
if [ -z "${TAG_PREFIX+x}" ]; then
if [ -f Cargo.toml ]; then
TAG_PREFIX=$(awk '
/^[[:space:]]*\[/ {
in_meta = ($0 ~ /^[[:space:]]*\[package\.metadata\.apdev\][[:space:]]*$/)
next
}
in_meta && /^[[:space:]]*tag_prefix[[:space:]]*=/ {
print
exit
}
' Cargo.toml | sed -E 's/^[^=]*=[[:space:]]*//; s/[[:space:]]+$//; s/^"//; s/"$//; s/^\x27//; s/\x27$//')
fi
if [ -z "${TAG_PREFIX:-}" ]; then
GIT_REL_PREFIX=$(git rev-parse --show-prefix 2>/dev/null | sed 's|/$||')
TAG_PREFIX="${GIT_REL_PREFIX:-rust}"
fi
fi
TAG_PREFIX="${TAG_PREFIX#/}"
TAG_PREFIX="${TAG_PREFIX%/}"
if [ -n "$TAG_PREFIX" ]; then
TAG="${TAG_PREFIX}/v${VERSION}"
else
TAG="v${VERSION}"
fi
RELEASE_TITLE="${RELEASE_TITLE:-${PROJECT_NAME} (Rust) v${VERSION}}"
echo -e "${CYAN}╔══════════════════════════════════════════════════════════╗${NC}"
echo -e "${CYAN}║ ${PROJECT_NAME} Release Script v${VERSION} (Rust)${NC}"
echo -e "${CYAN}╚══════════════════════════════════════════════════════════╝${NC}"
echo -e " Project: ${CYAN}${PROJECT_NAME}${NC}"
echo -e " Tag: ${CYAN}${TAG}${NC}"
echo -e " Release: ${CYAN}${RELEASE_TITLE}${NC}"
[ -n "$GITHUB_REPO" ] && echo -e " GitHub: ${CYAN}${GITHUB_REPO}${NC}"
[ -n "$GITHUB_ACCOUNT" ] && echo -e " GitHub user: ${CYAN}${GITHUB_ACCOUNT}${NC}"
echo ""
check_tag_exists() {
if git rev-parse "${TAG}" >/dev/null 2>&1; then
if git ls-remote --tags origin | grep -q "refs/tags/${TAG}$"; then
return 0
fi
fi
return 1
}
check_crates_uploaded() {
local crate_name="${1:-$PROJECT_NAME}"
local crate_version="${2:-$VERSION}"
curl -s "https://crates.io/api/v1/crates/${crate_name}/${crate_version}" \
| grep -q '"num"' && return 0 || return 1
}
is_workspace() {
grep -Eq '^[[:space:]]*\[workspace\][[:space:]]*$' Cargo.toml
}
# Publish all workspace members in dependency order.
# Uses `cargo publish --workspace` on Cargo 1.90+, falling back to publishing
# listed workspace members before the root package on older Cargo versions.
publish_workspace() {
if cargo publish --help 2>&1 | grep -q -- '--workspace'; then
echo -e "${CYAN}Detected Cargo workspace — running cargo publish --workspace${NC}"
cargo publish --workspace
return $?
fi
echo -e "${CYAN}Detected Cargo workspace — publishing workspace members before root crate${NC}"
local members
members=$(awk '
/^[[:space:]]*\[/ {
in_ws = ($0 ~ /^[[:space:]]*\[workspace\][[:space:]]*$/)
in_members = 0
next
}
in_ws && /^[[:space:]]*members[[:space:]]*=/ {
in_members = 1
}
in_members {
line = $0
while (match(line, /"[^"]+"/)) {
print substr(line, RSTART + 1, RLENGTH - 2)
line = substr(line, RSTART + RLENGTH)
}
if ($0 ~ /\]/) {
in_members = 0
}
}
' Cargo.toml)
local published_any_member=false
local member_dir member_toml member_name member_version
for member_dir in $members; do
member_toml="${member_dir}/Cargo.toml"
[ -f "$member_toml" ] || continue
if grep -Eq '^[[:space:]]*publish[[:space:]]*=[[:space:]]*false' "$member_toml"; then
continue
fi
member_name=$(grep -E '^[[:space:]]*name[[:space:]]*=' "$member_toml" | head -1 | sed -E 's/^[^=]*=[[:space:]]*"([^"]+)".*/\1/')
member_version=$(grep -E '^[[:space:]]*version[[:space:]]*=' "$member_toml" | head -1 | sed -E 's/^[^=]*=[[:space:]]*"([^"]+)".*/\1/')
[ -n "$member_name" ] || continue
[ "$member_name" = "$PROJECT_NAME" ] && continue
if [ -n "$member_version" ] && check_crates_uploaded "$member_name" "$member_version"; then
echo -e "${GREEN}✅ Workspace member ${member_name} v${member_version} already on crates.io — skipping${NC}"
continue
fi
echo -e "${CYAN}Publishing workspace member ${member_name}...${NC}"
cargo publish -p "$member_name" || return 1
published_any_member=true
done
if [ "$published_any_member" = true ]; then
echo -e "${CYAN}Waiting 15s for crates.io index to update...${NC}"
sleep 15
fi
echo -e "${CYAN}Publishing root crate ${PROJECT_NAME}...${NC}"
cargo publish -p "$PROJECT_NAME"
}
check_release_exists() {
if command -v gh &> /dev/null; then
gh release view "${TAG}" &>/dev/null && return 0 || return 1
fi
return 1
}
ask_yn() {
local prompt="$1"
local default="$2"
local answer
if [ "$SILENT" = true ]; then
if [ "$default" = "y" ]; then
echo -e "${YELLOW}${prompt} [Y/n] y (auto)${NC}"
return 0
else
echo -e "${YELLOW}${prompt} [y/N] n (auto)${NC}"
return 1
fi
fi
if [ "$default" = "y" ]; then
prompt="${prompt} [Y/n]"
else
prompt="${prompt} [y/N]"
fi
read -p "$(echo -e "${YELLOW}${prompt}${NC}") " answer
answer=${answer:-$default}
[[ $answer =~ ^[Yy]$ ]]
}
show_main_menu() {
if [ "$SILENT" = true ]; then
echo -e "${CYAN}Silent mode: auto-selecting all steps${NC}"
MENU_SELECTION="all"
return
fi
echo ""
echo -e "${CYAN}╔══════════════════════════════════════════════════════════╗${NC}"
echo -e "${CYAN}║ Release Steps Selection ║${NC}"
echo -e "${CYAN}╚══════════════════════════════════════════════════════════╝${NC}"
echo ""
echo -e "${CYAN}Select a step to execute:${NC}"
echo -e " ${CYAN}all) Execute all steps${NC}"
echo -e " ${CYAN}1) Step 1: Version Verification${NC}"
echo -e " ${CYAN}2) Step 2: Check Current Status${NC}"
echo -e " ${CYAN}3) Step 3: Run Tests${NC}"
echo -e " ${CYAN}4) Step 4: Build Release${NC}"
echo -e " ${CYAN}5) Step 5: Git Tag${NC}"
echo -e " ${CYAN}6) Step 6: Create GitHub Release${NC}"
echo -e " ${CYAN}7) Step 7: Publish to crates.io${NC}"
echo -e " ${CYAN}9) Show Summary${NC}"
echo -e " ${CYAN}0) Exit${NC}"
echo ""
read -p "$(echo -e "${YELLOW}Select option [all]:${NC} ") " MENU_SELECTION
MENU_SELECTION=${MENU_SELECTION:-all}
}
step1_version_verification() {
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}Step 1: Version Verification${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
CARGO_VERSION=$(grep -E '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
echo -e " Cargo.toml: ${CYAN}${CARGO_VERSION}${NC}"
echo -e " Script version: ${CYAN}${VERSION}${NC}"
if [ "$CARGO_VERSION" != "$VERSION" ]; then
echo -e "${RED}❌ Version mismatch: Cargo.toml (${CARGO_VERSION}) != script (${VERSION})${NC}"
return 1
fi
echo -e "${GREEN}✅ Versions match${NC}"
echo ""
return 0
}
step2_check_status() {
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}Step 2: Checking Current Status${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
if check_tag_exists; then
echo -e " Git Tag: ${GREEN}✅${NC} Tag ${TAG} exists on remote"
else
echo -e " Git Tag: ❌ Tag ${TAG} not found on remote"
fi
if check_crates_uploaded; then
echo -e " crates.io: ${GREEN}✅${NC} Version ${VERSION} found"
else
echo -e " crates.io: ❌ Version ${VERSION} not found"
fi
echo ""
return 0
}
step3_run_tests() {
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}Step 3: Run Tests${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
if ask_yn "Run cargo test?" "y"; then
if ! cargo test; then
echo -e "${RED}❌ Tests failed${NC}"
return 1
fi
echo -e "${GREEN}✅ All tests passed${NC}"
else
echo -e "${YELLOW}⚠️ Skipped tests${NC}"
fi
echo ""
return 0
}
step4_build_release() {
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}Step 4: Build Release${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
if ask_yn "Run cargo build --release?" "y"; then
if ! cargo build --release; then
echo -e "${RED}❌ Build failed${NC}"
return 1
fi
echo -e "${GREEN}✅ Build successful${NC}"
else
echo -e "${YELLOW}⚠️ Skipped build${NC}"
fi
echo ""
return 0
}
step5_git_tag() {
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}Step 5: Git Tag${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
if check_tag_exists; then
echo -e "${GREEN}✅ Tag ${TAG} already exists on remote${NC}"
if ! ask_yn "Create/update tag anyway?" "n"; then
echo ""
return 0
fi
fi
if ask_yn "Create Git tag ${TAG}?" "y"; then
if ! git diff-index --quiet HEAD --; then
echo -e "${YELLOW}⚠️ Warning: You have uncommitted changes${NC}"
if ! ask_yn "Continue anyway?" "n"; then
return 1
fi
fi
git tag -a "${TAG}" -m "${RELEASE_TITLE}"
echo -e "${GREEN}✅ Tag created${NC}"
if ask_yn "Push tag to remote?" "y"; then
git push origin "${TAG}"
echo -e "${GREEN}✅ Tag pushed${NC}"
fi
fi
echo ""
return 0
}
step6_github_release() {
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}Step 6: Create GitHub Release${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
if [ -z "$GITHUB_REPO" ]; then
echo -e "${YELLOW}⚠️ GitHub repo not detected. Skipping.${NC}"
echo ""
return 0
fi
if check_release_exists; then
echo -e "${GREEN}✅ Release ${TAG} already exists${NC}"
echo ""
return 0
fi
if ! command -v gh &> /dev/null; then
echo -e "${YELLOW}⚠️ GitHub CLI (gh) not found. Skipping.${NC}"
echo ""
return 0
fi
if ask_yn "Create GitHub Release ${TAG}?" "y"; then
RELEASE_NOTES="${RELEASE_TITLE}"
if [ -f "CHANGELOG.md" ]; then
NOTES=$(awk "/^## \[${VERSION}\]/ {found=1; next} found && /^## \[/ {exit} found {print}" CHANGELOG.md)
[ -n "$NOTES" ] && RELEASE_NOTES="$NOTES"
fi
NOTES_FILE=$(mktemp)
echo "$RELEASE_NOTES" > "$NOTES_FILE"
if gh release create "${TAG}" \
--title "${RELEASE_TITLE}" \
--notes-file "$NOTES_FILE" \
--repo "${GITHUB_REPO}"; then
echo -e "${GREEN}✅ GitHub Release created${NC}"
else
echo -e "${RED}❌ Failed to create GitHub Release${NC}"
fi
rm -f "$NOTES_FILE"
fi
echo ""
return 0
}
step7_publish_crates() {
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}Step 7: Publish to crates.io${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
if check_crates_uploaded; then
echo -e "${GREEN}✅ Version ${VERSION} already on crates.io${NC}"
if ! ask_yn "Publish anyway? (will fail if version exists)" "n"; then
echo ""
return 0
fi
fi
if ask_yn "Publish to crates.io?" "y"; then
if is_workspace; then
if ! publish_workspace; then
echo -e "${RED}❌ Publish failed${NC}"
return 1
fi
else
if ! cargo publish; then
echo -e "${RED}❌ Publish failed${NC}"
return 1
fi
fi
echo -e "${GREEN}✅ Published to crates.io!${NC}"
else
echo -e "${YELLOW}⚠️ Skipped publish${NC}"
fi
echo ""
return 0
}
step_summary() {
echo -e "${CYAN}╔══════════════════════════════════════════════════════════╗${NC}"
echo -e "${CYAN}║ Release Summary ║${NC}"
echo -e "${CYAN}╚══════════════════════════════════════════════════════════╝${NC}"
echo ""
echo -e " Version: ${CYAN}${VERSION}${NC}"
echo -e " Tag: ${CYAN}${TAG}${NC}"
echo ""
check_tag_exists && echo -e " ${GREEN}✅${NC} Git tag: ${TAG}" || echo -e " ⚠️ Git tag: not created"
check_crates_uploaded && echo -e " ${GREEN}✅${NC} crates.io: https://crates.io/crates/${PROJECT_NAME}/${VERSION}" \
|| echo -e " ⚠️ crates.io: not published yet"
echo ""
echo -e "${GREEN}✨ Release script completed!${NC}"
echo ""
}
# Main loop
while true; do
show_main_menu
SELECTION="$MENU_SELECTION"
case "$SELECTION" in
all|ALL|a|A)
echo ""
echo -e "${CYAN}Executing all steps...${NC}"
echo ""
run_step() {
local name="$1"; shift
if ! "$@"; then
if [ "$SILENT" = true ]; then
echo -e "${RED}${name} failed. Aborting.${NC}"
exit 1
else
echo -e "${YELLOW}${name} failed, continuing...${NC}"
fi
fi
}
if ! step1_version_verification; then
echo -e "${RED}Version verification failed. Exiting.${NC}"
exit 1
fi
step2_check_status
run_step "Step 3" step3_run_tests
run_step "Step 4" step4_build_release
run_step "Step 5" step5_git_tag
run_step "Step 6" step6_github_release
run_step "Step 7" step7_publish_crates
step_summary
break
;;
1) step1_version_verification ;;
2) step2_check_status ;;
3) step3_run_tests ;;
4) step4_build_release ;;
5) step5_git_tag ;;
6) step6_github_release ;;
7) step7_publish_crates ;;
9) step_summary ;;
0) echo -e "${CYAN}Exiting...${NC}"; exit 0 ;;
*) echo -e "${RED}Invalid selection.${NC}" ;;
esac
done