fix: Add --tag and --push flags to bump-version.sh

This addresses confusion where version bump doesn't trigger release.
The script now supports:
- --commit: Create git commit
- --tag: Create annotated git tag (requires --commit)
- --push: Push commit and tag (requires --tag)

Updated RELEASING.md to use: ./scripts/bump-version.sh X.Y.Z --commit --tag --push

Fixes the gap between version bump and actual release trigger.
This commit is contained in:
Steve Yegge
2025-11-05 00:08:08 -08:00
parent 1aa9a2e140
commit 38df6c8838
2 changed files with 102 additions and 38 deletions

View File

@@ -9,17 +9,21 @@ NC='\033[0m' # No Color
# Usage message
usage() {
echo "Usage: $0 <version> [--commit]"
echo "Usage: $0 <version> [--commit] [--tag] [--push]"
echo ""
echo "Bump version across all beads components."
echo ""
echo "Arguments:"
echo " <version> Semantic version (e.g., 0.9.3, 1.0.0)"
echo " --commit Automatically create a git commit (optional)"
echo " --tag Create annotated git tag after commit (requires --commit)"
echo " --push Push commit and tag to origin (requires --commit and --tag)"
echo ""
echo "Examples:"
echo " $0 0.9.3 # Update versions and show diff"
echo " $0 0.9.3 --commit # Update versions and commit"
echo " $0 0.9.3 # Update versions and show diff"
echo " $0 0.9.3 --commit # Update versions and commit"
echo " $0 0.9.3 --commit --tag # Update, commit, and tag"
echo " $0 0.9.3 --commit --tag --push # Full release preparation"
exit 1
}
@@ -62,9 +66,38 @@ main() {
NEW_VERSION=$1
AUTO_COMMIT=false
AUTO_TAG=false
AUTO_PUSH=false
if [ "$2" == "--commit" ]; then
AUTO_COMMIT=true
# Parse flags
shift # Remove version argument
while [ $# -gt 0 ]; do
case "$1" in
--commit)
AUTO_COMMIT=true
;;
--tag)
AUTO_TAG=true
;;
--push)
AUTO_PUSH=true
;;
*)
echo -e "${RED}Error: Unknown option '$1'${NC}"
usage
;;
esac
shift
done
# Validate flag dependencies
if [ "$AUTO_TAG" = true ] && [ "$AUTO_COMMIT" = false ]; then
echo -e "${RED}Error: --tag requires --commit${NC}"
exit 1
fi
if [ "$AUTO_PUSH" = true ] && [ "$AUTO_TAG" = false ]; then
echo -e "${RED}Error: --push requires --tag${NC}"
exit 1
fi
# Validate version format
@@ -200,16 +233,45 @@ Generated by scripts/bump-version.sh"
echo -e "${GREEN}✓ Commit created${NC}"
echo ""
echo "Next steps:"
echo " git push origin main"
# Auto-tag if requested
if [ "$AUTO_TAG" = true ]; then
echo "Creating git tag v$NEW_VERSION..."
git tag -a "v$NEW_VERSION" -m "Release v$NEW_VERSION"
echo -e "${GREEN}✓ Tag created${NC}"
echo ""
fi
# Auto-push if requested
if [ "$AUTO_PUSH" = true ]; then
echo "Pushing to origin..."
git push origin main
git push origin "v$NEW_VERSION"
echo -e "${GREEN}✓ Pushed to origin${NC}"
echo ""
echo -e "${GREEN}Release v$NEW_VERSION initiated!${NC}"
echo "GitHub Actions will build artifacts in ~5-10 minutes."
echo "Monitor: https://github.com/steveyegge/beads/actions"
elif [ "$AUTO_TAG" = true ]; then
echo "Next steps:"
echo " git push origin main"
echo " git push origin v$NEW_VERSION"
else
echo "Next steps:"
echo " git push origin main"
echo " git tag -a v$NEW_VERSION -m 'Release v$NEW_VERSION'"
echo " git push origin v$NEW_VERSION"
fi
else
echo "Review the changes above. To commit:"
echo " git add -A"
echo " git commit -m 'chore: Bump version to $NEW_VERSION'"
echo " git tag -a v$NEW_VERSION -m 'Release v$NEW_VERSION'"
echo " git push origin main"
echo " git push origin v$NEW_VERSION"
echo ""
echo "Or run with --commit to auto-commit:"
echo " $0 $NEW_VERSION --commit"
echo "Or run with flags to automate:"
echo " $0 $NEW_VERSION --commit --tag --push"
fi
}