Skip to content

Commit 7c9df95

Browse files
committed
feature: release vscode extension
1 parent a13e205 commit 7c9df95

5 files changed

Lines changed: 133 additions & 21 deletions

File tree

.github/workflows/release.yml

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,50 @@ jobs:
2727
- name: Run tests
2828
run: go test -v ./...
2929

30+
# Package VS Code extension
31+
package-extension:
32+
name: Package VS Code Extension
33+
needs: test
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
41+
- name: Sync extension version from tag
42+
run: |
43+
VERSION="${GITHUB_REF_NAME#v}"
44+
echo "Setting extension version to $VERSION"
45+
cd vscode-extension
46+
npm version $VERSION --no-git-tag-version --allow-same-version
47+
48+
- name: Set up Node.js
49+
uses: actions/setup-node@v4
50+
with:
51+
node-version: '20'
52+
53+
- name: Install dependencies
54+
working-directory: vscode-extension
55+
run: npm ci
56+
57+
- name: Compile extension
58+
working-directory: vscode-extension
59+
run: npm run compile
60+
61+
- name: Package extension
62+
working-directory: vscode-extension
63+
run: |
64+
npm install -g @vscode/vsce
65+
vsce package
66+
67+
- name: Upload extension artifact
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: vscode-extension
71+
path: vscode-extension/*.vsix
72+
retention-days: 1
73+
3074
# Build binaries on native platforms
3175
build:
3276
name: Build ${{ matrix.goos }}/${{ matrix.goarch }}
@@ -95,7 +139,7 @@ jobs:
95139
# Merge artifacts and create release
96140
release:
97141
name: Release
98-
needs: build
142+
needs: [build, package-extension]
99143
runs-on: ubuntu-latest
100144
steps:
101145
- name: Checkout code
@@ -122,6 +166,12 @@ jobs:
122166
123167
echo "Creating release archives for version ${VERSION}"
124168
169+
# Move VS Code extension to dist/
170+
if [ -f dist-downloads/vscode-extension/*.vsix ]; then
171+
echo "Including VS Code extension"
172+
mv dist-downloads/vscode-extension/*.vsix dist/
173+
fi
174+
125175
# Process each platform's artifacts
126176
for artifact_dir in dist-downloads/dist-*; do
127177
if [ ! -d "$artifact_dir" ]; then
@@ -182,11 +232,12 @@ jobs:
182232
files: |
183233
dist/*.tar.gz
184234
dist/*.zip
235+
dist/*.vsix
185236
dist/checksums.txt
186237
body: |
187238
## React Analyzer ${{ github.ref_name }}
188239
189-
### Installation
240+
### CLI Installation
190241
191242
**macOS/Linux (Recommended):**
192243
```bash
@@ -201,6 +252,22 @@ jobs:
201252
**Windows:**
202253
Download the `.zip` file below, extract it, and add `react-analyzer.exe` to your PATH.
203254
255+
### VS Code Extension Installation
256+
257+
**Install from VSIX:**
258+
1. Download `react-analyzer-${{ github.ref_name }}.vsix` below
259+
2. Install via command line:
260+
```bash
261+
code --install-extension react-analyzer-${{ github.ref_name }}.vsix
262+
```
263+
264+
Or via VS Code UI:
265+
1. Open Extensions view (Ctrl/Cmd+Shift+X)
266+
2. Click "..." → "Install from VSIX..."
267+
3. Select the downloaded `.vsix` file
268+
269+
See the [extension documentation](https://github.com/rautio/react-analyzer/blob/main/vscode-extension/README.md) for features and usage.
270+
204271
---
205272
206273
SHA256 checksums available in `checksums.txt`.

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,15 @@ React Analyzer includes a VS Code extension with enhanced features:
5555
- **Clickable Related Information** - Jump between related code locations
5656
- **Analyze on save** - Automatic analysis when files are saved
5757

58-
See [vscode-extension/README.md](vscode-extension/README.md) for installation and usage.
58+
**Installation:**
59+
60+
Download the latest `.vsix` from [Releases](https://github.com/rautio/react-analyzer/releases) and install:
61+
62+
```bash
63+
code --install-extension react-analyzer-<version>.vsix
64+
```
65+
66+
See [vscode-extension/README.md](vscode-extension/README.md) for full documentation.
5967

6068
## Usage
6169

RELEASING.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,22 @@ Follow [Semantic Versioning](https://semver.org/):
3232
- **MINOR** version for new functionality in a backward-compatible manner
3333
- **PATCH** version for backward-compatible bug fixes
3434

35-
### 2. Update Version in Code (Optional)
35+
### 2. Create and Push a Git Tag
3636

37-
The version in `cmd/react-analyzer/main.go` can be updated to match the release:
37+
**The git tag is the single source of truth for versioning** - you don't need to manually update version files in the repo.
3838

39-
```go
40-
const Version = "X.Y.Z"
41-
```
39+
How versioning works during releases:
4240

43-
This is optional as the version will also be set via ldflags during build.
41+
**CLI Binary:**
42+
- Source file `cmd/react-analyzer/main.go` contains `const Version = "dev"` (for development builds)
43+
- During release builds, GoReleaser uses ldflags to override this with the git tag version
44+
- Released binaries will show the correct version from the tag when running `react-analyzer --version`
4445

45-
### 3. Create and Push a Git Tag
46+
**VS Code Extension:**
47+
- Source file `vscode-extension/package.json` contains a placeholder version (manually managed)
48+
- During release, the `package-extension` job temporarily updates this to match the git tag
49+
- The packaged `.vsix` file contains the correct version from the tag
50+
- These version changes are **not committed back** - they're only used for packaging
4651

4752
```bash
4853
# Ensure you're on main and up to date
@@ -56,41 +61,44 @@ git tag -a vX.Y.Z -m "Release vX.Y.Z"
5661
git push origin vX.Y.Z
5762
```
5863

59-
**Important:** The tag MUST start with `v` (e.g., `v1.0.0`, not `1.0.0`)
64+
**Important:** The tag MUST start with `v` (e.g., `v0.0.3`, not `0.0.3`)
6065

61-
### 4. Automated Build Process
66+
### 3. Automated Build Process
6267

6368
Once the tag is pushed:
6469

6570
1. **Test Job**: Tests run once on Ubuntu to verify code quality
66-
2. **Build Jobs**: Binaries are built on native platforms in parallel (matrix strategy):
71+
2. **Extension Packaging Job**: Temporarily syncs version from git tag, then compiles and packages VS Code extension into `.vsix` file
72+
3. **Build Jobs**: CLI binaries are built on native platforms in parallel (matrix strategy):
6773
- **macOS builds** run on `macos-latest` (for darwin/amd64 and darwin/arm64)
6874
- **Linux builds** run on `ubuntu-latest` (for linux/amd64 and linux/arm64)
6975
- **Windows build** runs on `windows-latest` (for windows/amd64)
7076
- Each job uses `goreleaser build --single-target` for native compilation with CGO
71-
3. **Release Job**: After all builds complete:
72-
- Downloads all build artifacts
77+
4. **Release Job**: After all builds complete:
78+
- Downloads all build artifacts (CLI binaries + extension)
7379
- Creates archives (`.tar.gz` for Unix, `.zip` for Windows)
7480
- Generates SHA256 checksums
7581
- Creates GitHub Release with:
7682
- Release notes (auto-generated from commits)
7783
- All platform binaries attached
78-
- Installation instructions
84+
- VS Code extension `.vsix` file
85+
- Installation instructions for both CLI and extension
7986

8087
**Note on GoReleaser:** While GoReleaser is used for building (`goreleaser build`), the final packaging is done manually in GitHub Actions. This is the standard pattern for CGO projects without GoReleaser Pro. The `.goreleaser.yml` file is primarily for local development testing.
8188

82-
### 5. Verify the Release
89+
### 4. Verify the Release
8390

8491
1. Go to https://github.com/rautio/react-analyzer/releases
85-
2. Find your new release (e.g., `v1.0.0`)
86-
3. Check that all expected binaries are attached:
92+
2. Find your new release (e.g., `v0.0.3`)
93+
3. Check that all expected artifacts are attached:
8794
- `react-analyzer_X.Y.Z_darwin_amd64.tar.gz`
8895
- `react-analyzer_X.Y.Z_darwin_arm64.tar.gz`
8996
- `react-analyzer_X.Y.Z_linux_amd64.tar.gz`
9097
- `react-analyzer_X.Y.Z_linux_arm64.tar.gz`
9198
- `react-analyzer_X.Y.Z_windows_amd64.zip`
99+
- `react-analyzer-X.Y.Z.vsix`
92100
- `checksums.txt`
93-
4. Download and test a binary for your platform
101+
4. Download and test both CLI and extension
94102

95103
## Testing a Release Locally
96104

vscode-extension/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,35 @@
22

33
Static analysis extension for detecting React performance issues and antipatterns.
44

5+
## Installation
6+
7+
### From GitHub Releases (Recommended)
8+
9+
1. Download the latest `react-analyzer-*.vsix` from [Releases](https://github.com/rautio/react-analyzer/releases)
10+
2. Install via command line:
11+
```bash
12+
code --install-extension react-analyzer-<version>.vsix
13+
```
14+
15+
Or via VS Code UI:
16+
1. Open Extensions view (Ctrl/Cmd+Shift+X)
17+
2. Click "..." → "Install from VSIX..."
18+
3. Select the downloaded file
19+
20+
**Note:** The extension requires the React Analyzer CLI to be installed. The CLI is included in the same release.
21+
22+
### CLI Installation
23+
24+
The extension uses the React Analyzer CLI. Install it first:
25+
26+
**macOS/Linux:**
27+
```bash
28+
curl -fsSL https://raw.githubusercontent.com/rautio/react-analyzer/main/install.sh | sh
29+
```
30+
31+
**Windows:**
32+
Download the CLI `.zip` from [Releases](https://github.com/rautio/react-analyzer/releases).
33+
534
## Features
635

736
- **Real-time diagnostics**: See performance issues directly in your editor with squiggly underlines

vscode-extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "react-analyzer",
33
"displayName": "React Analyzer",
44
"description": "Static analysis tool for React performance issues",
5-
"version": "0.1.0",
5+
"version": "0.0.3",
66
"publisher": "react-analyzer",
77
"engines": {
88
"vscode": "^1.80.0"

0 commit comments

Comments
 (0)