66# ./dump-version.sh [OPTIONS] [VERSION]
77#
88# Options:
9- # --publish Also publish to crates.io after creating release
9+ # --skip-crates Skip publishing to crates.io (default: publish)
1010# --dry-run Show what would be done without making changes
1111# --help Show this help message
1212#
2222# 4. Update CHANGELOG.md ([Unreleased] -> [X.Y.Z] - date)
2323# 5. Create git tag vX.Y.Z
2424# 6. Commit the changes
25- # 7. (Optional) Publish to crates.io if --publish flag is set
25+ # 7. Publish to crates.io (unless --skip-crates is specified)
2626#
2727# After running this script:
2828# 1. Review the changes: git show HEAD
2929# 2. Push to release: git push origin br_release vX.Y.Z
3030#
3131# Environment variables:
32- # CARGO_REGISTRY_TOKEN - crates.io API token (for --publish )
32+ # CARGO_REGISTRY_TOKEN - crates.io API token (required for publishing )
3333#
3434
3535set -e
@@ -50,15 +50,15 @@ CHANGELOG_FILE="CHANGELOG.md"
5050CARGO_TOML=" Cargo.toml"
5151
5252# Options
53- PUBLISH_CRATES=false
53+ PUBLISH_CRATES=true
5454DRY_RUN=false
5555INPUT_VERSION=" "
5656
5757# Parse options
5858while [[ $# -gt 0 ]]; do
5959 case $1 in
60- --publish )
61- PUBLISH_CRATES=true
60+ --skip-crates|--no-crates )
61+ PUBLISH_CRATES=false
6262 shift
6363 ;;
6464 --dry-run)
@@ -69,7 +69,7 @@ while [[ $# -gt 0 ]]; do
6969 echo " Usage: $0 [OPTIONS] [VERSION]"
7070 echo " "
7171 echo " Options:"
72- echo " --publish Also publish to crates.io after creating release "
72+ echo " --skip-crates Skip publishing to crates.io (default: publish) "
7373 echo " --dry-run Show what would be done without making changes"
7474 echo " --help Show this help message"
7575 echo " "
@@ -78,13 +78,13 @@ while [[ $# -gt 0 ]]; do
7878 echo " Format: X.Y.Z or X.Y.Z.E"
7979 echo " "
8080 echo " Examples:"
81- echo " $0 # Release with gopher-orch version "
81+ echo " $0 # Release to GitHub and crates.io "
8282 echo " $0 0.1.2 # Release specific version"
83- echo " $0 --publish # Release and publish to crates.io "
83+ echo " $0 --skip-crates # Release to GitHub only "
8484 echo " $0 --dry-run # Preview changes without executing"
8585 echo " "
8686 echo " Environment variables:"
87- echo " CARGO_REGISTRY_TOKEN crates.io API token (for --publish )"
87+ echo " CARGO_REGISTRY_TOKEN crates.io API token (required for publishing )"
8888 echo " "
8989 exit 0
9090 ;;
@@ -111,9 +111,11 @@ if [ "$DRY_RUN" = true ]; then
111111fi
112112
113113if [ " $PUBLISH_CRATES " = true ]; then
114- echo -e " ${CYAN} crates.io publishing: ENABLED${NC} "
115- echo " "
114+ echo -e " ${CYAN} Publishing to: GitHub + crates.io${NC} "
115+ else
116+ echo -e " ${YELLOW} Publishing to: GitHub only (--skip-crates)${NC} "
116117fi
118+ echo " "
117119
118120# -----------------------------------------------------------------------------
119121# Step 1: Fetch latest gopher-orch version from GitHub releases
@@ -417,24 +419,19 @@ else
417419fi
418420
419421# -----------------------------------------------------------------------------
420- # Step 8: Publish to crates.io (optional)
422+ # Step 8: Publish to crates.io
421423# -----------------------------------------------------------------------------
424+ echo " "
422425if [ " $PUBLISH_CRATES " = true ]; then
423- echo " "
424426 echo -e " ${YELLOW} Step 8: Publishing to crates.io...${NC} "
425427
426428 if [ " $DRY_RUN " = true ]; then
427- echo -e " ${YELLOW} [DRY RUN] Would run: cargo publish --dry-run${NC} "
429+ echo -e " ${YELLOW} [DRY RUN] Would run: cargo publish${NC} "
430+ echo -e " ${CYAN} Verifying package...${NC} "
428431 cargo publish --dry-run 2>&1 | head -20 || true
429432 else
430433 echo -e " ${CYAN} Running cargo publish...${NC} "
431434
432- # Check if logged in
433- if ! cargo login --help & > /dev/null; then
434- echo -e " ${RED} Error: cargo login not available${NC} "
435- exit 1
436- fi
437-
438435 # Publish
439436 if cargo publish; then
440437 echo -e " ${GREEN} Successfully published to crates.io${NC} "
@@ -445,6 +442,8 @@ if [ "$PUBLISH_CRATES" = true ]; then
445442 exit 1
446443 fi
447444 fi
445+ else
446+ echo -e " ${YELLOW} Step 8: Skipping crates.io publish (--skip-crates)${NC} "
448447fi
449448
450449echo " "
@@ -457,6 +456,8 @@ echo -e "Tag: ${CYAN}$TAG_VERSION${NC}"
457456echo -e " gopher-orch: ${CYAN} $GOPHER_ORCH_VERSION ${NC} "
458457if [ " $PUBLISH_CRATES " = true ]; then
459458 echo -e " crates.io: ${GREEN} Published${NC} "
459+ else
460+ echo -e " crates.io: ${YELLOW} Skipped${NC} "
460461fi
461462echo " "
462463echo -e " ${YELLOW} Next steps:${NC} "
@@ -467,14 +468,16 @@ echo -e "${CYAN}After pushing:${NC}"
467468echo " - CI workflow will create GitHub Release"
468469echo " - Native libraries will be attached to release"
469470if [ " $PUBLISH_CRATES " = false ]; then
470- echo " - (Optional) Publish to crates.io: cargo publish"
471+ echo " - Publish to crates.io manually : cargo publish"
471472fi
472473echo " "
473474echo -e " ${CYAN} Users can install with:${NC} "
474- echo " "
475- echo " # From crates.io (if published)"
476- echo " [dependencies]"
477- echo " gopher-orch = \" $TARGET_VERSION \" "
475+ if [ " $PUBLISH_CRATES " = true ]; then
476+ echo " "
477+ echo " # From crates.io"
478+ echo " [dependencies]"
479+ echo " gopher-orch = \" $TARGET_VERSION \" "
480+ fi
478481echo " "
479482echo " # From GitHub"
480483echo " [dependencies]"
0 commit comments