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

@@ -75,31 +75,48 @@ Before starting a release:
## 1. Prepare Release
### Update Version
### Update Version and Create Release Tag
Use the version bump script to update all version references:
Use the version bump script to update all version references and create the release tag:
```bash
# Dry run - shows what will change
./scripts/bump-version.sh 0.22.0
# Review the diff
git diff
# Commit if it looks good
./scripts/bump-version.sh 0.22.0 --commit
# Review the diff, then commit, tag, and push in one command
./scripts/bump-version.sh 0.22.0 --commit --tag --push
```
This updates:
- `cmd/bd/main.go` - CLI version constant
- `integrations/mcp/server/pyproject.toml` - MCP server version
- `npm-package/package.json` - npm package version
- `Formula/bd.rb` - Homebrew formula version
- `.goreleaser.yml` - Release configuration
- `cmd/bd/version.go` - CLI version constant
- `integrations/beads-mcp/pyproject.toml` - MCP server version
- `.claude-plugin/plugin.json` - Plugin version
- `.claude-plugin/marketplace.json` - Marketplace version
- `README.md` - Documentation version
- `PLUGIN.md` - Version requirements
### Update CHANGELOG.md
The `--commit --tag --push` flags will:
1. Create a git commit with all version changes
2. Create an annotated tag `v0.22.0`
3. Push both commit and tag to origin
Add release notes:
This triggers GitHub Actions to build release artifacts automatically.
**Alternative (step-by-step):**
```bash
# Just commit
./scripts/bump-version.sh 0.22.0 --commit
# Then manually tag and push
git tag -a v0.22.0 -m "Release v0.22.0"
git push origin main
git push origin v0.22.0
```
### Update CHANGELOG.md (Optional but Recommended)
Add release notes before or after running the version bump:
```markdown
## [0.22.0] - 2025-11-04
@@ -118,21 +135,6 @@ Add release notes:
- Changed behavior of B (migration guide)
```
### Commit and Tag
```bash
# Commit version bump and changelog
git add -A
git commit -m "chore: Bump version to 0.22.0"
# Create annotated tag
git tag -a v0.22.0 -m "Release v0.22.0"
# Push to GitHub
git push origin main
git push origin v0.22.0
```
## 2. GitHub Release
### Using GoReleaser (Recommended)

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
}