Skip to content

Commit 2fafe30

Browse files
RahulHereRahulHere
authored andcommitted
Make crates.io publishing the default in dump-version.sh (#2)
Change release workflow to publish to both GitHub and crates.io by default: - Default behavior now publishes to GitHub + crates.io - Add --skip-crates flag to publish to GitHub only - Update help text and examples to reflect new defaults - Show clear output indicating which targets are being published
1 parent 34352e7 commit 2fafe30

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

dump-version.sh

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
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
#
@@ -22,14 +22,14 @@
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

3535
set -e
@@ -50,15 +50,15 @@ CHANGELOG_FILE="CHANGELOG.md"
5050
CARGO_TOML="Cargo.toml"
5151

5252
# Options
53-
PUBLISH_CRATES=false
53+
PUBLISH_CRATES=true
5454
DRY_RUN=false
5555
INPUT_VERSION=""
5656

5757
# Parse options
5858
while [[ $# -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
111111
fi
112112

113113
if [ "$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}"
116117
fi
118+
echo ""
117119

118120
# -----------------------------------------------------------------------------
119121
# Step 1: Fetch latest gopher-orch version from GitHub releases
@@ -417,24 +419,19 @@ else
417419
fi
418420

419421
# -----------------------------------------------------------------------------
420-
# Step 8: Publish to crates.io (optional)
422+
# Step 8: Publish to crates.io
421423
# -----------------------------------------------------------------------------
424+
echo ""
422425
if [ "$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}"
448447
fi
449448

450449
echo ""
@@ -457,6 +456,8 @@ echo -e "Tag: ${CYAN}$TAG_VERSION${NC}"
457456
echo -e "gopher-orch: ${CYAN}$GOPHER_ORCH_VERSION${NC}"
458457
if [ "$PUBLISH_CRATES" = true ]; then
459458
echo -e "crates.io: ${GREEN}Published${NC}"
459+
else
460+
echo -e "crates.io: ${YELLOW}Skipped${NC}"
460461
fi
461462
echo ""
462463
echo -e "${YELLOW}Next steps:${NC}"
@@ -467,14 +468,16 @@ echo -e "${CYAN}After pushing:${NC}"
467468
echo " - CI workflow will create GitHub Release"
468469
echo " - Native libraries will be attached to release"
469470
if [ "$PUBLISH_CRATES" = false ]; then
470-
echo " - (Optional) Publish to crates.io: cargo publish"
471+
echo " - Publish to crates.io manually: cargo publish"
471472
fi
472473
echo ""
473474
echo -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
478481
echo ""
479482
echo " # From GitHub"
480483
echo " [dependencies]"

0 commit comments

Comments
 (0)