|
| 1 | +# Release Process Documentation |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This project uses an automated GitHub Actions workflow for releasing the VS Code extension. The workflow handles version bumping, building, testing, publishing to the marketplace, and creating GitHub releases. |
| 6 | + |
| 7 | +## Prerequisites |
| 8 | + |
| 9 | +### Required Secrets |
| 10 | + |
| 11 | +You need to configure the following secret in your GitHub repository: |
| 12 | + |
| 13 | +1. **`VSCE_PAT`** - Personal Access Token for VS Code Marketplace |
| 14 | + - Go to [Azure DevOps](https://dev.azure.com/) |
| 15 | + - Create a new organization or use existing one |
| 16 | + - Navigate to User Settings → Personal Access Tokens |
| 17 | + - Create a new token with the following: |
| 18 | + - **Name**: VS Code Marketplace Publishing |
| 19 | + - **Organization**: All accessible organizations |
| 20 | + - **Expiration**: Custom (1 year recommended) |
| 21 | + - **Scopes**: |
| 22 | + - Marketplace → **Manage** (required) |
| 23 | + - Copy the token and add it to GitHub: |
| 24 | + - Repository Settings → Secrets and variables → Actions |
| 25 | + - New repository secret: `VSCE_PAT` |
| 26 | + |
| 27 | +## Automated Release Workflow |
| 28 | + |
| 29 | +### Trigger |
| 30 | + |
| 31 | +The release workflow is triggered manually via GitHub Actions: |
| 32 | + |
| 33 | +1. Go to **Actions** tab in your repository |
| 34 | +2. Select **Release Extension** workflow |
| 35 | +3. Click **Run workflow** |
| 36 | +4. Choose version bump type: |
| 37 | + - **auto** (default): Automatically determines version bump based on commits |
| 38 | + - **major**: Breaking changes (1.0.0 → 2.0.0) |
| 39 | + - **minor**: New features (1.1.0 → 1.2.0) |
| 40 | + - **patch**: Bug fixes (1.1.0 → 1.1.1) |
| 41 | + |
| 42 | +### What the Workflow Does |
| 43 | + |
| 44 | +#### ✅ 1. Version Detection & Validation |
| 45 | + |
| 46 | +- Reads current version from `package.json` |
| 47 | +- Checks if version tag already exists in Git |
| 48 | +- Prevents duplicate releases |
| 49 | + |
| 50 | +#### ✅ 2. Commit Analysis (Auto mode) |
| 51 | + |
| 52 | +- Analyzes commits since last release |
| 53 | +- Determines version bump based on conventional commits: |
| 54 | + - `feat!:` or `BREAKING CHANGE:` → **major** |
| 55 | + - `feat:` → **minor** |
| 56 | + - `fix:`, `chore:`, `docs:` → **patch** |
| 57 | + |
| 58 | +#### ✅ 3. Version Bumping |
| 59 | + |
| 60 | +- Automatically bumps version if tag exists |
| 61 | +- Updates `package.json` and `package-lock.json` |
| 62 | +- Commits changes with message: `chore: bump version to X.Y.Z` |
| 63 | +- Pushes version bump commit |
| 64 | + |
| 65 | +#### ✅ 4. Build & Test |
| 66 | + |
| 67 | +- Runs TypeScript type checking (`npm run type-check`) |
| 68 | +- Runs linter (`npm run lint:check`) |
| 69 | +- Compiles extension (`npm run compile`) |
| 70 | +- Runs test suite (`npm run test`) |
| 71 | + |
| 72 | +#### ✅ 5. Package Extension |
| 73 | + |
| 74 | +- Packages extension as `.vsix` file |
| 75 | +- Names file: `diffy-explain-ai-X.Y.Z.vsix` |
| 76 | + |
| 77 | +#### ✅ 6. Publish to Marketplace |
| 78 | + |
| 79 | +- Publishes extension to VS Code Marketplace |
| 80 | +- Uses `VSCE_PAT` secret for authentication |
| 81 | +- Updates existing extension listing |
| 82 | + |
| 83 | +#### ✅ 7. Create Git Tag |
| 84 | + |
| 85 | +- Creates annotated Git tag: `vX.Y.Z` |
| 86 | +- Pushes tag to repository |
| 87 | + |
| 88 | +#### ✅ 8. Generate Release Notes |
| 89 | + |
| 90 | +- Automatically categorizes commits: |
| 91 | + - ✨ **Features**: `feat:` commits |
| 92 | + - 🐛 **Bug Fixes**: `fix:` commits |
| 93 | + - 📝 **Documentation**: `docs:` commits |
| 94 | + - 🔧 **Maintenance**: `chore:`, `build:`, `ci:` commits |
| 95 | +- Includes commit hashes for traceability |
| 96 | + |
| 97 | +#### ✅ 9. Create GitHub Release |
| 98 | + |
| 99 | +- Creates GitHub Release with tag |
| 100 | +- Includes auto-generated release notes |
| 101 | +- Attaches `.vsix` file as release asset |
| 102 | +- Not marked as draft or prerelease |
| 103 | + |
| 104 | +#### ✅ 10. Upload Artifacts |
| 105 | + |
| 106 | +- Uploads `.vsix` file as workflow artifact |
| 107 | +- Retention: 90 days |
| 108 | +- Available for download from workflow run |
| 109 | + |
| 110 | +## Version Bump Examples |
| 111 | + |
| 112 | +### Automatic Version Bumping |
| 113 | + |
| 114 | +**Scenario 1**: Bug fixes and chores |
| 115 | + |
| 116 | +```bash |
| 117 | +git log v1.0.0..HEAD |
| 118 | +# - fix: resolve OpenAI API timeout |
| 119 | +# - chore: update dependencies |
| 120 | +# - docs: improve README |
| 121 | + |
| 122 | +Result: 1.0.0 → 1.0.1 (patch) |
| 123 | +``` |
| 124 | + |
| 125 | +**Scenario 2**: New features |
| 126 | + |
| 127 | +```bash |
| 128 | +git log v1.1.0..HEAD |
| 129 | +# - feat: add custom commit templates |
| 130 | +# - fix: handle empty diffs |
| 131 | + |
| 132 | +Result: 1.1.0 → 1.2.0 (minor) |
| 133 | +``` |
| 134 | + |
| 135 | +**Scenario 3**: Breaking changes |
| 136 | + |
| 137 | +```bash |
| 138 | +git log v2.0.0..HEAD |
| 139 | +# - feat!: redesign AI service interface |
| 140 | +# - BREAKING CHANGE: remove deprecated methods |
| 141 | + |
| 142 | +Result: 2.0.0 → 3.0.0 (major) |
| 143 | +``` |
| 144 | + |
| 145 | +### Manual Version Bumping |
| 146 | + |
| 147 | +You can override automatic detection: |
| 148 | + |
| 149 | +1. **Patch Release**: Bug fixes only |
| 150 | + - Select `patch` in workflow input |
| 151 | + - 1.1.0 → 1.1.1 |
| 152 | + |
| 153 | +2. **Minor Release**: New features |
| 154 | + - Select `minor` in workflow input |
| 155 | + - 1.1.0 → 1.2.0 |
| 156 | + |
| 157 | +3. **Major Release**: Breaking changes |
| 158 | + - Select `major` in workflow input |
| 159 | + - 1.1.0 → 2.0.0 |
| 160 | + |
| 161 | +## Manual Release Process |
| 162 | + |
| 163 | +If you need to release manually: |
| 164 | + |
| 165 | +### 1. Update Version |
| 166 | + |
| 167 | +```bash |
| 168 | +npm version patch # or minor, major |
| 169 | +``` |
| 170 | + |
| 171 | +### 2. Build Extension |
| 172 | + |
| 173 | +```bash |
| 174 | +npm run type-check |
| 175 | +npm run lint |
| 176 | +npm run compile |
| 177 | +``` |
| 178 | + |
| 179 | +### 3. Package Extension |
| 180 | + |
| 181 | +```bash |
| 182 | +npm install -g @vscode/vsce |
| 183 | +vsce package |
| 184 | +``` |
| 185 | + |
| 186 | +### 4. Publish to Marketplace |
| 187 | + |
| 188 | +```bash |
| 189 | +vsce publish -p YOUR_PERSONAL_ACCESS_TOKEN |
| 190 | +``` |
| 191 | + |
| 192 | +### 5. Create GitHub Release |
| 193 | + |
| 194 | +```bash |
| 195 | +git tag -a v1.1.0 -m "Release v1.1.0" |
| 196 | +git push origin v1.1.0 |
| 197 | + |
| 198 | +# Then create release on GitHub with VSIX file |
| 199 | +``` |
| 200 | + |
| 201 | +## Troubleshooting |
| 202 | + |
| 203 | +### Error: "Tag already exists" |
| 204 | + |
| 205 | +The workflow checks if a tag exists and automatically bumps the version. If you see this error: |
| 206 | + |
| 207 | +1. Check existing tags: `git tag -l` |
| 208 | +2. Delete tag if needed: `git tag -d vX.Y.Z && git push origin :refs/tags/vX.Y.Z` |
| 209 | +3. Re-run workflow |
| 210 | + |
| 211 | +### Error: "VSCE_PAT is not set" |
| 212 | + |
| 213 | +1. Verify secret exists in repository settings |
| 214 | +2. Ensure it's named exactly `VSCE_PAT` |
| 215 | +3. Generate new token if expired |
| 216 | + |
| 217 | +### Error: "Extension validation failed" |
| 218 | + |
| 219 | +1. Check `package.json` for required fields |
| 220 | +2. Ensure `engines.vscode` matches `@types/vscode` |
| 221 | +3. Verify all files referenced in `package.json` exist |
| 222 | + |
| 223 | +### Tests Failed |
| 224 | + |
| 225 | +Tests failures won't block the release (marked as `continue-on-error`), but you should: |
| 226 | + |
| 227 | +1. Review test failures in workflow logs |
| 228 | +2. Fix failing tests |
| 229 | +3. Consider making tests blocking by removing `continue-on-error: true` |
| 230 | + |
| 231 | +## Best Practices |
| 232 | + |
| 233 | +### Commit Messages |
| 234 | + |
| 235 | +Use conventional commits for automatic version bumping: |
| 236 | + |
| 237 | +```bash |
| 238 | +# Features (minor bump) |
| 239 | +git commit -m "feat: add new AI model support" |
| 240 | +git commit -m "feat(git): implement file filtering" |
| 241 | + |
| 242 | +# Bug fixes (patch bump) |
| 243 | +git commit -m "fix: resolve memory leak in diff parser" |
| 244 | +git commit -m "fix(ai): handle API rate limiting" |
| 245 | + |
| 246 | +# Breaking changes (major bump) |
| 247 | +git commit -m "feat!: redesign configuration API" |
| 248 | +git commit -m "feat: new config format |
| 249 | +
|
| 250 | +BREAKING CHANGE: Configuration schema has changed" |
| 251 | + |
| 252 | +# Other types (patch bump) |
| 253 | +git commit -m "docs: update installation guide" |
| 254 | +git commit -m "chore: update dependencies" |
| 255 | +git commit -m "style: format code with Biome" |
| 256 | +``` |
| 257 | + |
| 258 | +### Release Cadence |
| 259 | + |
| 260 | +- **Patch releases**: Weekly or as needed for bug fixes |
| 261 | +- **Minor releases**: Monthly for new features |
| 262 | +- **Major releases**: Quarterly or when breaking changes necessary |
| 263 | + |
| 264 | +### Pre-Release Checklist |
| 265 | + |
| 266 | +Before triggering a release: |
| 267 | + |
| 268 | +1. ✅ Ensure all tests pass locally |
| 269 | +2. ✅ Update CHANGELOG.md if maintained |
| 270 | +3. ✅ Review open issues and PRs |
| 271 | +4. ✅ Test extension locally with `vsce package` |
| 272 | +5. ✅ Verify documentation is up to date |
| 273 | + |
| 274 | +## Monitoring |
| 275 | + |
| 276 | +### After Release |
| 277 | + |
| 278 | +Check the following: |
| 279 | + |
| 280 | +1. **Marketplace**: Extension appears at <https://marketplace.visualstudio.com/items?itemName=hitclaw.diffy-explain-ai> |
| 281 | +2. **GitHub Release**: Release created with VSIX file attached |
| 282 | +3. **Git Tag**: Tag pushed to repository |
| 283 | +4. **Workflow Artifacts**: VSIX available for 90 days |
| 284 | + |
| 285 | +### Rollback |
| 286 | + |
| 287 | +If you need to rollback a release: |
| 288 | + |
| 289 | +1. Unpublish from marketplace (contact VS Code team) |
| 290 | +2. Delete GitHub release |
| 291 | +3. Delete Git tag: `git push origin :refs/tags/vX.Y.Z` |
| 292 | +4. Revert version in `package.json` |
| 293 | + |
| 294 | +## Resources |
| 295 | + |
| 296 | +- [Publishing Extensions](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) |
| 297 | +- [Conventional Commits](https://www.conventionalcommits.org/) |
| 298 | +- [Semantic Versioning](https://semver.org/) |
| 299 | +- [GitHub Actions Documentation](https://docs.github.com/en/actions) |
0 commit comments