This document outlines the release process for opencode-test.
Following Semantic Versioning (SemVer):
- PATCH (1.0.1): Bug fixes, documentation updates, minor improvements
- MINOR (1.1.0): New features, backward compatible changes
- MAJOR (2.0.0): Breaking changes, API changes
Before creating a release:
- Clean working directory: No uncommitted changes
- Master branch: Must be on the master branch
- All tests passing: Full test suite must pass
- Documentation updated: README.md and command docs current
- CHANGELOG updated: Document all changes since last release
Run the pre-publish checks:
npm run prepublish-checkThis validates:
- ✅ All required files present
- ✅ package.json validity
- ✅ CLI executable functionality
- ✅ Linting passes
- ✅ All tests pass
- ✅ Coverage requirements met
- ✅ Package structure correct
- ✅ CLI installation works
- ✅ No high-severity vulnerabilities
Choose the appropriate release type:
# Bug fixes and minor improvements
npm run release:patch
# New features (backward compatible)
npm run release:minor
# Breaking changes
npm run release:majorThe release script automatically:
- Validates environment: Checks git status and branch
- Runs full test suite: Ensures quality
- Bumps version: Updates package.json and package-lock.json
- Creates git commit: Commits version changes
- Creates git tag: Tags the release (format: v1.2.3)
- Pushes to GitHub: Pushes commits and tags
Once the tag is pushed, GitHub Actions automatically:
-
Runs CI pipeline:
- Tests on Node.js 16.x, 18.x, 20.x
- Tests on Ubuntu, macOS
- Runs security audit
- Validates CLI functionality
-
Publishes to NPM:
- Runs pre-publish validation
- Publishes package to NPM registry
- Uses NPM_TOKEN secret for authentication
-
Creates GitHub Release:
- Generates release notes
- Attaches package assets
- Marks release as published
If automatic release fails, you can publish manually:
# Check git status
git status
# Run tests
npm run ci
# Run pre-publish checks
npm run prepublish-check# Bump version (patch/minor/major)
npm version patch
# Push with tags
git push origin master --tags# Login to NPM (if not already)
npm login
# Publish package
npm publish- Go to GitHub Releases
- Click "Draft a new release"
- Select the tag you just created
- Generate release notes
- Publish release
After release, verify everything works:
# Install from NPM
npm install -g opencode-test@latest
# Verify version
opencode-test --version
# Test basic functionality
opencode-test --help
opencode-test init --help- Check that GitHub release was created
- Verify release notes are accurate
- Confirm assets are attached
- Review GitHub Actions workflow runs
- Ensure all jobs passed
- Check for any warnings or issues
Git not clean:
git status
git add .
git commit -m "Prepare for release"Tests failing:
npm test
npm run lint:fixNPM publish fails:
npm login
npm whoami
npm run prepublish-checkTag already exists:
git tag -d v1.2.3
git push origin :refs/tags/v1.2.3If a release fails partway through:
-
Check what was completed:
git log --oneline -5 git tag -l | grep v npm view opencode-test version -
Reset if needed:
# Reset version in package.json if needed git checkout HEAD~1 package.json package-lock.json # Delete local tag if created git tag -d v1.2.3 # Delete remote tag if pushed git push origin :refs/tags/v1.2.3
-
Start over: Run the release process again
The NPM_TOKEN secret must be configured in GitHub repository settings:
-
Generate NPM token:
- Go to npmjs.com → Account → Access Tokens
- Create "Automation" token
- Copy the token
-
Add to GitHub secrets:
- Go to repository Settings → Secrets and variables → Actions
- Add new secret:
NPM_TOKEN - Paste the token value
-
Token scope: Token must have "Automation" permissions for publishing
Before releasing:
- All features implemented and tested
- Documentation updated (README.md, command docs)
- CHANGELOG.md updated with release notes
- Version number follows SemVer
- All tests passing locally
- No security vulnerabilities
- Working directory clean
- On main branch with latest changes
After releasing:
- NPM package published successfully
- GitHub release created
- CI/CD pipeline completed
- Installation from NPM works
- Version verification passes
- Dependent projects notified (if applicable)
For critical bugs requiring immediate release:
-
Create hotfix branch:
git checkout -b hotfix/critical-fix
-
Make minimal fix: Only fix the critical issue
-
Test thoroughly:
npm run ci npm run prepublish-check
-
Merge to master:
git checkout master git merge hotfix/critical-fix
-
Release patch version:
npm run release:patch
For release issues or questions:
- GitHub Issues: Report a problem
- GitHub Discussions: Ask questions