Skip to content

Commit c17245e

Browse files
RahulHereRahulHere
authored andcommitted
Move crates.io publishing to CI workflow only
dump-version.sh now only prepares the release locally: - Updates Cargo.toml and CHANGELOG.md - Creates git commit and tag - No longer publishes to crates.io directly Publishing to crates.io is handled by the CI workflow after pushing, which provides better automation and consistency.
1 parent f32a9d3 commit c17245e

1 file changed

Lines changed: 16 additions & 69 deletions

File tree

dump-version.sh

Lines changed: 16 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# ./dump-version.sh [OPTIONS] [VERSION]
77
#
88
# Options:
9-
# --skip-crates Skip publishing to crates.io (default: publish)
109
# --dry-run Show what would be done without making changes
1110
# --help Show this help message
1211
#
@@ -22,14 +21,11 @@
2221
# 4. Update CHANGELOG.md ([Unreleased] -> [X.Y.Z] - date)
2322
# 5. Create git tag vX.Y.Z
2423
# 6. Commit the changes
25-
# 7. Publish to crates.io (unless --skip-crates is specified)
2624
#
2725
# After running this script:
2826
# 1. Review the changes: git show HEAD
2927
# 2. Push to release: git push origin br_release vX.Y.Z
30-
#
31-
# Environment variables:
32-
# CARGO_REGISTRY_TOKEN - crates.io API token (required for publishing)
28+
# 3. CI workflow will create GitHub Release and publish to crates.io
3329
#
3430

3531
set -e
@@ -50,17 +46,12 @@ CHANGELOG_FILE="CHANGELOG.md"
5046
CARGO_TOML="Cargo.toml"
5147

5248
# Options
53-
PUBLISH_CRATES=true
5449
DRY_RUN=false
5550
INPUT_VERSION=""
5651

5752
# Parse options
5853
while [[ $# -gt 0 ]]; do
5954
case $1 in
60-
--skip-crates|--no-crates)
61-
PUBLISH_CRATES=false
62-
shift
63-
;;
6455
--dry-run)
6556
DRY_RUN=true
6657
shift
@@ -69,7 +60,6 @@ while [[ $# -gt 0 ]]; do
6960
echo "Usage: $0 [OPTIONS] [VERSION]"
7061
echo ""
7162
echo "Options:"
72-
echo " --skip-crates Skip publishing to crates.io (default: publish)"
7363
echo " --dry-run Show what would be done without making changes"
7464
echo " --help Show this help message"
7565
echo ""
@@ -78,13 +68,16 @@ while [[ $# -gt 0 ]]; do
7868
echo " Format: X.Y.Z or X.Y.Z.E"
7969
echo ""
8070
echo "Examples:"
81-
echo " $0 # Release to GitHub and crates.io"
82-
echo " $0 0.1.2 # Release specific version"
83-
echo " $0 --skip-crates # Release to GitHub only"
71+
echo " $0 # Prepare release with gopher-orch version"
72+
echo " $0 0.1.2 # Prepare release for specific version"
8473
echo " $0 --dry-run # Preview changes without executing"
8574
echo ""
86-
echo "Environment variables:"
87-
echo " CARGO_REGISTRY_TOKEN crates.io API token (required for publishing)"
75+
echo "After running this script, push to trigger CI:"
76+
echo " git push origin br_release vX.Y.Z"
77+
echo ""
78+
echo "CI workflow will:"
79+
echo " - Create GitHub Release with native binaries"
80+
echo " - Publish to crates.io"
8881
echo ""
8982
exit 0
9083
;;
@@ -110,13 +103,6 @@ if [ "$DRY_RUN" = true ]; then
110103
echo ""
111104
fi
112105

113-
if [ "$PUBLISH_CRATES" = true ]; then
114-
echo -e "${CYAN}Publishing to: GitHub + crates.io${NC}"
115-
else
116-
echo -e "${YELLOW}Publishing to: GitHub only (--skip-crates)${NC}"
117-
fi
118-
echo ""
119-
120106
# -----------------------------------------------------------------------------
121107
# Step 1: Fetch latest gopher-orch version from GitHub releases
122108
# -----------------------------------------------------------------------------
@@ -424,35 +410,6 @@ else
424410
echo -e " ${YELLOW}[DRY RUN] Would create tag $TAG_VERSION${NC}"
425411
fi
426412

427-
# -----------------------------------------------------------------------------
428-
# Step 8: Publish to crates.io
429-
# -----------------------------------------------------------------------------
430-
echo ""
431-
if [ "$PUBLISH_CRATES" = true ]; then
432-
echo -e "${YELLOW}Step 8: Publishing to crates.io...${NC}"
433-
434-
if [ "$DRY_RUN" = true ]; then
435-
echo -e " ${YELLOW}[DRY RUN] Would run: cargo publish${NC}"
436-
echo -e " ${CYAN}Verifying package...${NC}"
437-
cargo publish --dry-run 2>&1 | head -20 || true
438-
else
439-
echo -e " ${CYAN}Running cargo publish...${NC}"
440-
441-
# Publish
442-
if cargo publish; then
443-
echo -e " ${GREEN}Successfully published to crates.io${NC}"
444-
else
445-
echo -e "${RED}Error: Failed to publish to crates.io${NC}"
446-
echo "The git commit and tag were created. You can manually publish later with:"
447-
echo " cargo publish"
448-
exit 1
449-
fi
450-
fi
451-
else
452-
echo -e "${YELLOW}Step 8: Skipping crates.io publish (--skip-crates)${NC}"
453-
fi
454-
455-
echo ""
456413
echo -e "${GREEN}========================================${NC}"
457414
echo -e "${GREEN} Release preparation complete!${NC}"
458415
echo -e "${GREEN}========================================${NC}"
@@ -463,30 +420,20 @@ if [ "$CARGO_VERSION" != "$TARGET_VERSION" ]; then
463420
fi
464421
echo -e "Tag: ${CYAN}$TAG_VERSION${NC}"
465422
echo -e "gopher-orch: ${CYAN}$GOPHER_ORCH_VERSION${NC}"
466-
if [ "$PUBLISH_CRATES" = true ]; then
467-
echo -e "crates.io: ${GREEN}Published${NC}"
468-
else
469-
echo -e "crates.io: ${YELLOW}Skipped${NC}"
470-
fi
471423
echo ""
472424
echo -e "${YELLOW}Next steps:${NC}"
473425
echo " 1. Review the commit: git show HEAD"
474426
echo " 2. Push to release: git push origin br_release $TAG_VERSION"
475427
echo ""
476-
echo -e "${CYAN}After pushing:${NC}"
477-
echo " - CI workflow will create GitHub Release"
478-
echo " - Native libraries will be attached to release"
479-
if [ "$PUBLISH_CRATES" = false ]; then
480-
echo " - Publish to crates.io manually: cargo publish"
481-
fi
428+
echo -e "${CYAN}After pushing, CI will:${NC}"
429+
echo " - Create GitHub Release with native binaries"
430+
echo " - Publish to crates.io"
482431
echo ""
483432
echo -e "${CYAN}Users can install with:${NC}"
484-
if [ "$PUBLISH_CRATES" = true ]; then
485-
echo ""
486-
echo " # From crates.io"
487-
echo " [dependencies]"
488-
echo " gopher-orch = \"$CARGO_VERSION\""
489-
fi
433+
echo ""
434+
echo " # From crates.io"
435+
echo " [dependencies]"
436+
echo " gopher-orch = \"$CARGO_VERSION\""
490437
echo ""
491438
echo " # From GitHub"
492439
echo " [dependencies]"

0 commit comments

Comments
 (0)