|
| 1 | +# Release Workflow Documentation |
| 2 | + |
| 3 | +This document describes the automated release workflow for the EGE VSCode Plugin. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The release workflow is triggered when you push a git tag to the repository. The behavior depends on the tag format: |
| 8 | + |
| 9 | +### Tag Formats |
| 10 | + |
| 11 | +#### 1. Stable Release Tags |
| 12 | +**Pattern:** `X.Y.Z` (e.g., `1.0.3`, `2.1.0`) |
| 13 | +- **Regex:** `/^[0-9]+\.[0-9]+\.[0-9]+$/` |
| 14 | +- **Behavior:** |
| 15 | + - Builds and tests the extension |
| 16 | + - Validates tag version matches `package.json` version |
| 17 | + - Publishes to VS Code Marketplace as a **stable release** |
| 18 | + - Creates a GitHub release (not marked as pre-release) |
| 19 | + - Attaches VSIX file to GitHub release |
| 20 | + |
| 21 | +#### 2. Pre-Release Tags |
| 22 | +**Pattern:** `X.Y.Z-suffix` (e.g., `1.0.3-alpha`, `1.0.3-beta`, `1.0.3-rc.1`) |
| 23 | +- **Regex:** `/^[0-9]+\.[0-9]+\.[0-9]+-.+$/` |
| 24 | +- **Supported suffixes:** `-alpha`, `-beta`, `-rc`, `-rc.1`, etc. |
| 25 | +- **Behavior:** |
| 26 | + - Builds and tests the extension |
| 27 | + - Validates tag version (numeric part) matches `package.json` version |
| 28 | + - Publishes to VS Code Marketplace as a **pre-release** |
| 29 | + - Creates a GitHub release (marked as pre-release) |
| 30 | + - Attaches VSIX file to GitHub release |
| 31 | + |
| 32 | +**Important:** The VS Code Marketplace doesn't support version suffixes in the actual extension version. The pre-release suffix is only used in the git tag name. The actual version in `package.json` should be the numeric version only (e.g., `1.0.3`). |
| 33 | + |
| 34 | +#### 3. Non-Release Tags |
| 35 | +**Examples:** `v1.0.3`, `latest`, `dev`, `test` |
| 36 | +- **Behavior:** |
| 37 | + - Builds and tests the extension |
| 38 | + - **Does NOT publish** to marketplace |
| 39 | + - **Does NOT create** GitHub release |
| 40 | + - Useful for testing the build process |
| 41 | + |
| 42 | +## Version Consistency Check |
| 43 | + |
| 44 | +For all release tags (both stable and pre-release), the workflow validates that: |
| 45 | +- The numeric version in the tag matches the version in `package.json` |
| 46 | +- If they don't match, the workflow fails with an error |
| 47 | + |
| 48 | +**Example:** |
| 49 | +- Tag: `1.0.3` → Must match `package.json` version `1.0.3` ✓ |
| 50 | +- Tag: `1.0.3-alpha` → Must match `package.json` version `1.0.3` ✓ |
| 51 | +- Tag: `1.0.4` → If `package.json` has `1.0.3`, workflow fails ✗ |
| 52 | + |
| 53 | +## How to Create a Release |
| 54 | + |
| 55 | +### Stable Release |
| 56 | + |
| 57 | +1. Update the version in `package.json`: |
| 58 | + ```bash |
| 59 | + # Edit package.json and set "version": "1.0.4" |
| 60 | + ``` |
| 61 | + |
| 62 | +2. Commit the version change: |
| 63 | + ```bash |
| 64 | + git add package.json |
| 65 | + git commit -m "Bump version to 1.0.4" |
| 66 | + git push |
| 67 | + ``` |
| 68 | + |
| 69 | +3. Create and push a tag: |
| 70 | + ```bash |
| 71 | + git tag 1.0.4 |
| 72 | + git push origin 1.0.4 |
| 73 | + ``` |
| 74 | + |
| 75 | +### Pre-Release |
| 76 | + |
| 77 | +1. Update the version in `package.json` to the base version: |
| 78 | + ```bash |
| 79 | + # Edit package.json and set "version": "1.0.4" |
| 80 | + ``` |
| 81 | + |
| 82 | +2. Commit the version change: |
| 83 | + ```bash |
| 84 | + git add package.json |
| 85 | + git commit -m "Bump version to 1.0.4" |
| 86 | + git push |
| 87 | + ``` |
| 88 | + |
| 89 | +3. Create and push a pre-release tag: |
| 90 | + ```bash |
| 91 | + git tag 1.0.4-beta |
| 92 | + git push origin 1.0.4-beta |
| 93 | + ``` |
| 94 | + |
| 95 | +## Required Secrets |
| 96 | + |
| 97 | +The workflow requires the following GitHub secret: |
| 98 | +- `MS_STORE_TOKEN`: Personal Access Token for publishing to VS Code Marketplace |
| 99 | + |
| 100 | +## Workflow Steps |
| 101 | + |
| 102 | +1. **Extract Tag Name** - Gets the tag that triggered the workflow |
| 103 | +2. **Validate Tag Format** - Determines if it's stable, pre-release, or non-release |
| 104 | +3. **Extract Version** - Extracts numeric version from tag (for release tags only) |
| 105 | +4. **Check Version Consistency** - Validates tag version matches package.json |
| 106 | +5. **Setup Node.js** - Installs Node.js environment |
| 107 | +6. **Install Dependencies** - Runs `npm install` |
| 108 | +7. **Build** - Compiles TypeScript to JavaScript |
| 109 | +8. **Install VSCE** - Installs VS Code Extension packaging tool |
| 110 | +9. **Build VSIX** - Creates the extension package |
| 111 | +10. **Publish to Marketplace** - Publishes to VS Code Marketplace (release tags only) |
| 112 | +11. **Create GitHub Release** - Creates GitHub release with VSIX file (release tags only) |
| 113 | + |
| 114 | +## Troubleshooting |
| 115 | + |
| 116 | +### Workflow fails with "Version mismatch" |
| 117 | +- Ensure the tag version matches the version in `package.json` |
| 118 | +- For pre-release tags, only the numeric part needs to match |
| 119 | + |
| 120 | +### Marketplace publish fails |
| 121 | +- Check that `MS_STORE_TOKEN` secret is correctly configured |
| 122 | +- Verify the token has appropriate permissions |
| 123 | +- The workflow will fail if marketplace publishing fails |
| 124 | + |
| 125 | +### Build or test fails |
| 126 | +- The workflow runs for all tags, even non-release tags |
| 127 | +- Fix build or test issues before creating release tags |
| 128 | + |
| 129 | +## Examples |
| 130 | + |
| 131 | +### Valid Stable Release Tags |
| 132 | +- `1.0.3` |
| 133 | +- `2.0.0` |
| 134 | +- `10.20.30` |
| 135 | + |
| 136 | +### Valid Pre-Release Tags |
| 137 | +- `1.0.3-alpha` |
| 138 | +- `1.0.3-beta` |
| 139 | +- `1.0.3-rc` |
| 140 | +- `1.0.3-rc.1` |
| 141 | +- `2.0.0-beta.2` |
| 142 | + |
| 143 | +### Non-Release Tags (Build & Test Only) |
| 144 | +- `v1.0.3` (has 'v' prefix) |
| 145 | +- `latest` |
| 146 | +- `dev` |
| 147 | +- `test` |
| 148 | +- `1.0` (incomplete version) |
0 commit comments