This document describes the release process for docs-coderef.
The release process is automated using semantic-release. It automatically determines versions based on Conventional Commits, generates CHANGELOGs, publishes to npm, and creates GitHub releases.
To enable release automation, the following configuration is required:
-
Create NPM Token
- Visit https://www.npmjs.com/settings/YOUR_USERNAME/tokens
- Click "Generate New Token"
- Token type: Automation
- Scope: Publish access to
@cawpeascope
-
Configure GitHub Secrets
- Go to GitHub repository Settings → Secrets and variables → Actions
- Click "New repository secret"
- Name:
NPM_TOKEN - Value: Paste the npm token created above
- Understanding of Conventional Commits specification
- Familiarity with project Git Conventions
Releases are automatically triggered when merging to the main branch.
-
Develop on a Feature Branch
git checkout -b feature/your-feature # Develop and commit -
Follow Conventional Commits
# For new features (MINOR version bump) git commit -m "feat: add new validation feature" # For bug fixes (PATCH version bump) git commit -m "fix: correct reference parsing" # For breaking changes (MAJOR version bump) git commit -m "feat!: change API interface BREAKING CHANGE: API signature has changed"
-
Create Pull Request for Review
git push origin feature/your-feature # Create PR on GitHub -
Merge to main Branch
- After PR is reviewed and approved, merge to
mainbranch - Release workflow will automatically start after merge
- After PR is reviewed and approved, merge to
-
Verify Release Completion
- Check Release workflow execution in GitHub Actions
- Verify new version is published on npm
- Verify new release is created on GitHub Releases
You can manually trigger a release from the GitHub UI when needed.
-
Open GitHub Repository Page
-
Navigate to Actions Tab
- Click the "Actions" tab at the top
-
Select Release Workflow
- Select "Release" workflow from the left sidebar
-
Run Workflow
- Click the "Run workflow" button in the top right
- Select branch (usually
main) - Click "Run workflow"
-
Verify Release Completion
- Check workflow execution logs
- Verify on npm and GitHub Releases
Note: Due to semantic-release configuration, releases will only be created from the main branch.
When the Release workflow runs, the following operations are executed sequentially:
-
Checkout Code
- Fetch complete Git history (
fetch-depth: 0)
- Fetch complete Git history (
-
Quality Checks
- Build (
npm run build) - Tests (
npm test) - Lint (
npm run lint) - Type check (
npm run type-check)
- Build (
-
Run semantic-release
- Commit analysis (analyze commits since last release)
- Version determination (based on commit types)
- Update CHANGELOG.md
- Update package.json version
- Publish package to npm
- Create GitHub release
- Commit changes and create tag
Versions are automatically determined based on commit messages:
| Commit Type | Example | Version Change |
|---|---|---|
feat: |
feat: add new feature |
MINOR (0.1.0 → 0.2.0) |
fix: |
fix: resolve bug |
PATCH (0.1.0 → 0.1.1) |
BREAKING CHANGE: |
In footer | MAJOR (0.1.0 → 1.0.0) |
feat!: or fix!: |
feat!: change API |
MAJOR (0.1.0 → 1.0.0) |
docs:, chore:, ci:, etc. |
- | No release |
See Git Conventions for more details.
When a release succeeds, the following are automatically created:
-
npm Package
- https://www.npmjs.com/package/docs-coderef
- New version is published
-
Git Tag
- Format:
vX.Y.Z(e.g.,v0.2.0) - Created on
mainbranch
- Format:
-
GitHub Release
- Auto-generated release notes
- Changelog based on commits
-
CHANGELOG.md
- New version entry is added
- Maintains Keep a Changelog format
-
Version Bump Commit
- Commit message:
chore(release): X.Y.Z [skip ci] [skip ci]prevents workflow from re-running on this commit
- Commit message:
After a release, verify the following:
- Visit https://github.com/cawpea/docs-coderef/actions
- Verify Release workflow completed successfully
- Ensure all steps have green checkmarks
# Check latest version
npm view docs-coderef version
# Test package installation
npm install docs-coderef@latest- Visit https://github.com/cawpea/docs-coderef/releases
- Verify new release was created
- Verify release notes are correctly generated
- Review CHANGELOG.md in the repository
- Verify new version entry was added
- Verify changes are correctly documented
# List all tags
git tag -l
# Check latest tag
git describe --tags --abbrev=0Symptom: No release is created after merging to main branch
Causes and Solutions:
-
No Releasable Commits
- If only
docs:,chore:,ci:commits exist, no version bump occurs - Check semantic-release logs: "no release" message indicates this is normal
- If only
-
Quality Check Failure
- Release is aborted if build, tests, lint, or type check fails
- Check GitHub Actions logs for errors and fix them
-
NPM_TOKEN Misconfiguration
- Verify
NPM_TOKENis correctly set in GitHub Secrets - Verify token has appropriate permissions (Automation token, Publish access)
- Verify
Symptom: Release workflow succeeds but package is not published to npm
Causes and Solutions:
-
Authentication Error
- Check NPM_TOKEN expiration
- Regenerate token and update GitHub Secrets
-
Package Name Conflict
- Verify package with same name doesn't already exist on npm
- For scoped packages (e.g.,
@company/package-name), verifypublishConfig.access: "public"is set
-
Network Error
- May be a temporary error
- Manually re-run the workflow
Symptom: Package is published to npm but GitHub Release is not created
Causes and Solutions:
-
Insufficient Permissions
- Check
permissionssettings in Release workflow - Verify
contents: writeis set
- Check
-
GITHUB_TOKEN Issue
- Verify
GITHUB_TOKENis correctly set in workflow - If
persist-credentials: false, additional token configuration may be needed
- Verify
Symptom: Manual execution shows "no release"
Causes and Solutions:
-
Branch Verification
- Verify you're not running from a branch other than
main - Check
branchesconfiguration in.releaserc.json
- Verify you're not running from a branch other than
-
Commit History Verification
- Verify there are releasable commits (
feat:,fix:, etc.) since last release
- Verify there are releasable commits (
Procedures for rolling back a release when issues occur.
Warning: npm allows unpublish within 72 hours of publication.
# Unpublish package version (within 72 hours)
npm unpublish docs-coderef@X.Y.Z
# Or deprecate package (after 72 hours)
npm deprecate docs-coderef@X.Y.Z "This version has critical issues. Please use vX.Y.Z-1 instead."-
Delete from GitHub UI
- Visit https://github.com/cawpea/docs-coderef/releases
- Open the relevant release
- Click "Delete" button
-
Delete from CLI
gh release delete vX.Y.Z
# Delete local tag
git tag -d vX.Y.Z
# Delete remote tag
git push --delete origin vX.Y.Z# Switch to main branch
git checkout main
git pull origin main
# Identify release commit
git log --oneline | grep "chore(release)"
# Revert release commit (undo with new commit)
git revert <commit-sha>
# Push to remote
git push origin mainWarning: Use git revert to preserve history while undoing changes. Avoid git reset --hard on shared repositories as it rewrites history.
Steps to release a fixed version after rolling back a problematic release:
-
Create Fix Branch
git checkout -b hotfix/critical-fix
-
Fix the Issue
# Make fixes git add . git commit -m "fix: resolve critical issue in vX.Y.Z"
-
Create PR and Merge
- Follow normal release process
- PATCH version will automatically increment due to
fix:commit
- Strictly follow Conventional Commits specification
- Use scopes to clarify where changes were made
feat(cli): add --verbose option fix(parser): handle edge case in CODE_REF
- Test thoroughly locally
- Verify CI passes before merging
- Update documentation for breaking changes
- Verify publication on npm package page
- Review release notes on GitHub Releases
- Manually supplement release notes if needed
- Follow Semantic Versioning
- Before 1.0.0 (0.x.x), MINOR versions may include breaking changes
- From 1.0.0 onwards, breaking changes must increment MAJOR version