|
| 1 | +# Release Process |
| 2 | + |
| 3 | +This document describes the release process for the multi-block-plugin-scaffold repository. |
| 4 | + |
| 5 | +## Git Flow Workflow |
| 6 | + |
| 7 | +This repository uses **Git Flow** for managing releases: |
| 8 | + |
| 9 | +- **`develop`** - Active development branch where all features are merged |
| 10 | +- **`main`** - Stable branch updated only via releases |
| 11 | +- **Feature branches** - Created from and merged back to `develop` |
| 12 | + |
| 13 | +## Creating a Release |
| 14 | + |
| 15 | +### 1. Prepare on Develop Branch |
| 16 | + |
| 17 | +Ensure you're on the develop branch with a clean working directory: |
| 18 | + |
| 19 | +```bash |
| 20 | +git checkout develop |
| 21 | +git pull origin develop |
| 22 | +git status # Should show clean working directory |
| 23 | +``` |
| 24 | + |
| 25 | +### 2. Run the Release Agent |
| 26 | + |
| 27 | +```bash |
| 28 | +# Dry run to preview changes |
| 29 | +node scripts/agents/release-scaffold.agent.js --version=X.Y.Z --dry-run |
| 30 | + |
| 31 | +# Execute the release |
| 32 | +node scripts/agents/release-scaffold.agent.js --version=X.Y.Z |
| 33 | +``` |
| 34 | + |
| 35 | +The agent will: |
| 36 | +- ✅ Validate git status is clean |
| 37 | +- ✅ Validate version format (semantic versioning) |
| 38 | +- ✅ Run all tests |
| 39 | +- ✅ Run linting (JS + CSS) |
| 40 | +- ✅ Update CHANGELOG.md (move Unreleased → vX.Y.Z with date) |
| 41 | +- ✅ Update package.json version |
| 42 | +- ✅ Create commit: `chore: Release vX.Y.Z` |
| 43 | +- ✅ Create git tag: `vX.Y.Z` |
| 44 | + |
| 45 | +### 3. Push to Develop |
| 46 | + |
| 47 | +```bash |
| 48 | +git push origin develop |
| 49 | +``` |
| 50 | + |
| 51 | +### 4. Merge to Main |
| 52 | + |
| 53 | +You have two options: |
| 54 | + |
| 55 | +#### Option A: Direct Merge (Recommended for patch releases) |
| 56 | + |
| 57 | +```bash |
| 58 | +git checkout main |
| 59 | +git pull origin main |
| 60 | +git merge develop --no-ff -m "Release vX.Y.Z" |
| 61 | +git push origin main |
| 62 | +git push origin vX.Y.Z |
| 63 | +git checkout develop |
| 64 | +``` |
| 65 | + |
| 66 | +#### Option B: Pull Request (Recommended for major/minor releases) |
| 67 | + |
| 68 | +```bash |
| 69 | +# Create PR from develop → main via GitHub UI or CLI |
| 70 | +gh pr create --base main --head develop --title "Release vX.Y.Z" |
| 71 | + |
| 72 | +# After PR is merged: |
| 73 | +git push origin vX.Y.Z |
| 74 | +``` |
| 75 | + |
| 76 | +### 5. Verify Release |
| 77 | + |
| 78 | +GitHub will automatically: |
| 79 | +- Create a release from the vX.Y.Z tag |
| 80 | +- Build and attach assets (if configured) |
| 81 | +- Publish to npm (if configured) |
| 82 | + |
| 83 | +Visit: `https://github.com/lightspeedwp/multi-block-plugin-scaffold/releases/tag/vX.Y.Z` |
| 84 | + |
| 85 | +## Version Numbering |
| 86 | + |
| 87 | +We follow [Semantic Versioning](https://semver.org/): |
| 88 | + |
| 89 | +- **MAJOR** (X.0.0) - Breaking changes |
| 90 | +- **MINOR** (0.X.0) - New features, backward compatible |
| 91 | +- **PATCH** (0.0.X) - Bug fixes, backward compatible |
| 92 | + |
| 93 | +### Examples |
| 94 | + |
| 95 | +- `1.0.0` → `1.0.1` - Bug fix release |
| 96 | +- `1.0.1` → `1.1.0` - New feature release |
| 97 | +- `1.1.0` → `2.0.0` - Breaking change release |
| 98 | + |
| 99 | +## Troubleshooting |
| 100 | + |
| 101 | +### "Working directory is not clean" |
| 102 | + |
| 103 | +Commit or stash your changes before releasing: |
| 104 | + |
| 105 | +```bash |
| 106 | +git status |
| 107 | +git add . |
| 108 | +git commit -m "Your commit message" |
| 109 | +``` |
| 110 | + |
| 111 | +### "Tests failed" |
| 112 | + |
| 113 | +Fix failing tests before releasing: |
| 114 | + |
| 115 | +```bash |
| 116 | +npm test |
| 117 | +npm run lint:js |
| 118 | +npm run lint:css |
| 119 | +``` |
| 120 | + |
| 121 | +### "Version already exists" |
| 122 | + |
| 123 | +The version tag already exists. Either: |
| 124 | +- Use a different version number |
| 125 | +- Delete the existing tag (not recommended) |
| 126 | + |
| 127 | +## Post-Release |
| 128 | + |
| 129 | +After a successful release: |
| 130 | + |
| 131 | +1. **Announce** - Share the release notes with your team |
| 132 | +2. **Monitor** - Watch for issues in the new version |
| 133 | +3. **Document** - Update any external documentation |
| 134 | +4. **Plan** - Start planning the next release |
| 135 | + |
| 136 | +## Emergency Hotfix |
| 137 | + |
| 138 | +For urgent fixes to production (main): |
| 139 | + |
| 140 | +```bash |
| 141 | +# Create hotfix branch from main |
| 142 | +git checkout main |
| 143 | +git checkout -b hotfix/X.Y.Z |
| 144 | + |
| 145 | +# Make fixes and commit |
| 146 | +git add . |
| 147 | +git commit -m "fix: Emergency fix description" |
| 148 | + |
| 149 | +# Run release process |
| 150 | +node scripts/agents/release-scaffold.agent.js --version=X.Y.Z |
| 151 | + |
| 152 | +# Merge to main |
| 153 | +git checkout main |
| 154 | +git merge hotfix/X.Y.Z --no-ff |
| 155 | +git push origin main |
| 156 | +git push origin vX.Y.Z |
| 157 | + |
| 158 | +# Merge back to develop |
| 159 | +git checkout develop |
| 160 | +git merge hotfix/X.Y.Z --no-ff |
| 161 | +git push origin develop |
| 162 | + |
| 163 | +# Delete hotfix branch |
| 164 | +git branch -d hotfix/X.Y.Z |
| 165 | +``` |
| 166 | + |
| 167 | +## References |
| 168 | + |
| 169 | +- [Git Flow Workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) |
| 170 | +- [Semantic Versioning](https://semver.org/) |
| 171 | +- [Keep a Changelog](https://keepachangelog.com/) |
0 commit comments