Release Command
The buddy release command creates and publishes new versions of your libraries and packages, triggering the CI/CD release workflow.
Basic Usage
buddy release
Command Syntax
buddy release [options]
Options
| Option | Description |
|---|---|
--dry-run | Run the release without actually releasing |
-p, --project [project] | Target a specific project |
--verbose | Enable verbose output |
Release Process
When you run buddy release, Stacks:
- Validates the current git state
- Determines the next version (based on commits)
- Updates version numbers in package files
- Generates changelog entries
- Creates git tag
- Triggers GitHub Actions release workflow
- Publishes packages to npm
Examples
Standard Release
buddy release
Output:
buddy release
Triggered CI/CD Release via GitHub Actions
Follow along: https://github.com/stacksjs/stacks/actions
Completed in 1.23s
Dry Run
Preview what would happen without making changes:
buddy release --dry-run
Verbose Release
buddy release --verbose
Version Determination
Versions are determined automatically based on conventional commits:
| Commit Type | Version Bump |
|---|---|
fix: | Patch (0.0.X) |
feat: | Minor (0.X.0) |
feat!: or BREAKING CHANGE | Major (X.0.0) |
Examples
fix: resolve login issue -> 1.0.0 to 1.0.1
feat: add new dashboard -> 1.0.1 to 1.1.0
feat!: redesign API -> 1.1.0 to 2.0.0
Pre-release Checklist
Before releasing:
-
All tests pass
buddy test -
Code is linted
buddy lint -
Types are valid
buddy test:types -
Working directory is clean
git status -
On the correct branch
git branch
CI/CD Integration
The release command triggers a GitHub Actions workflow that:
- Runs all tests
- Builds all packages
- Publishes to npm
- Creates GitHub release
- Updates documentation
Workflow Configuration
The release workflow is defined in .github/workflows/release.yml:
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run build
- run: bun run test
- run: npm publish
npm Publishing
Ensure npm is configured for publishing:
# Login to npm
npm login
# Or use token in CI
NPM_TOKEN=your-token
Changelog Generation
Releases automatically update CHANGELOG.md:
## [1.2.0] - 2024-01-15
### Features
- Add user dashboard (#123)
- Implement dark mode (#124)
### Bug Fixes
- Fix login timeout issue (#125)
Troubleshooting
Dirty Working Directory
Error: Working directory is not clean
Solution: Commit or stash changes:
git add .
buddy commit
# or
git stash
Not on Main Branch
Error: Must be on main branch to release
Solution: Switch to main:
git checkout main
git pull
buddy release
npm Publish Failed
Error: npm publish failed
Solutions:
- Check npm login:
npm whoami - Verify package name is available
- Check npm token permissions
No Commits to Release
Error: No new commits since last release
Solution: Ensure you have conventional commits:
buddy commit
buddy release
GitHub Actions Failed
Check the Actions tab in GitHub for details:
https://github.com/your-repo/actions
Best Practices
Use Dry Run First
# Preview the release
buddy release --dry-run
# If everything looks good
buddy release
Keep Main Branch Clean
# Always work in feature branches
git checkout -b feature/my-feature
# Merge to main when ready
git checkout main
git merge feature/my-feature
# Then release
buddy release
Write Good Commit Messages
Following conventional commits ensures proper versioning:
# Good
feat(auth): add OAuth2 support
fix(ui): resolve modal z-index issue
# Bad
update stuff
fix bug
Release Frequently
Small, frequent releases are better than large, infrequent ones:
- Easier to debug issues
- Faster feedback
- Lower risk
Related Commands
- buddy commit - Create conventional commits
- buddy changelog - Generate changelog
- buddy build - Build packages