Skip to content

Commit af2b78e

Browse files
ci(debugger): Add release automation for the VS Code Debugger extension (#281)
This adds a configuration for releasing the StarlingMonkey debugger extension to the vscode marketplace. At the same time, changes to the debugger are ignored in StarlingMonkey releases.
1 parent afcf222 commit af2b78e

File tree

3 files changed

+159
-0
lines changed

3 files changed

+159
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# This workflow publishes the StarlingMonkey VS Code debugger extension to the VS Code Marketplace.
2+
# It uses release-please to manage versioning and changelog, and only triggers when files
3+
# in the debugger/vscode-dap-extension folder are changed.
4+
#
5+
# Prerequisites:
6+
# - A VSCE_PAT secret must be configured in the repository settings
7+
# (get a Personal Access Token from https://dev.azure.com with Marketplace publisher access)
8+
# - The publisher 'bytecodealliance' must exist in the VS Code Marketplace
9+
# (see https://code.visualstudio.com/api/working-with-extensions/publishing-extension)
10+
11+
name: VS Code Debugger Extension Release
12+
13+
on:
14+
push:
15+
branches:
16+
- main
17+
paths:
18+
- 'debugger/vscode-dap-extension/**'
19+
20+
permissions:
21+
contents: write
22+
issues: write
23+
pull-requests: write
24+
25+
jobs:
26+
release-please:
27+
runs-on: ubuntu-latest
28+
outputs:
29+
release_created: ${{ steps.release.outputs.release_created }}
30+
tag_name: ${{ steps.release.outputs.tag_name }}
31+
version: ${{ steps.release.outputs.version }}
32+
steps:
33+
- uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445 #v4.2.0
34+
id: release
35+
with:
36+
token: ${{ secrets.GITHUB_TOKEN }}
37+
config-file: debugger/vscode-dap-extension/release-please-config.json
38+
manifest-file: debugger/vscode-dap-extension/.release-please-manifest.json
39+
40+
publish-extension:
41+
needs: release-please
42+
if: ${{ needs.release-please.outputs.release_created }}
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
46+
47+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 #v4.4.0
48+
with:
49+
node-version: 'lts/*'
50+
registry-url: 'https://registry.npmjs.org'
51+
52+
- name: Install dependencies
53+
working-directory: debugger/vscode-dap-extension
54+
run: npm ci
55+
56+
- name: Build extension
57+
working-directory: debugger/vscode-dap-extension
58+
run: npm run build
59+
60+
- name: Package extension
61+
working-directory: debugger/vscode-dap-extension
62+
run: npm run package
63+
64+
- name: Publish to VS Code Marketplace
65+
working-directory: debugger/vscode-dap-extension
66+
run: npm run publish
67+
env:
68+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
69+
70+
- name: Upload VSIX to Release
71+
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 #2.3.2
72+
with:
73+
tag_name: ${{ needs.release-please.outputs.tag_name }}
74+
files: debugger/vscode-dap-extension/*.vsix
75+
make_latest: false
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# VS Code Extension Publishing Setup
2+
3+
This document explains how the automated publishing workflow for the StarlingMonkey VS Code debugger extension works.
4+
5+
## Overview
6+
7+
The VS Code extension is published automatically to the VS Code Marketplace when changes are merged to the `main` branch that affect files in the `debugger/vscode-dap-extension/` directory.
8+
9+
## Workflow
10+
11+
The publishing process uses two GitHub Actions jobs:
12+
13+
1. **release-please**: Creates or updates a release PR when changes are detected. When this PR is merged, it creates a GitHub release with an appropriate version tag (e.g., `v0.3.0`).
14+
15+
2. **publish-extension**: When a release is created, this job:
16+
- Builds the extension
17+
- Packages it as a `.vsix` file
18+
- Publishes it to the VS Code Marketplace
19+
- Uploads the `.vsix` file to the GitHub release
20+
21+
## Configuration
22+
23+
### Release Please
24+
25+
The extension is configured as a separate package in the top-level release-please config file.
26+
27+
### Required Secret
28+
29+
To publish to the VS Code Marketplace, a `VSCE_PAT` secret must be configured in the repository settings:
30+
31+
1. Go to https://dev.azure.com
32+
2. Create a Personal Access Token (PAT) with:
33+
- Organization: `All accessible organizations`
34+
- Expiration: Choose an appropriate duration
35+
- Scopes: Select `Marketplace` > `Manage`
36+
3. Add this token as a repository secret named `VSCE_PAT` in the GitHub repository settings
37+
38+
### Publisher Account
39+
40+
The extension is published under the `bytecodealliance` publisher account on the VS Code Marketplace.
41+
Publishing a fork under a different account requires changing the `package.json` file accordingly.
42+
In that case, make sure to also change the name and update the other metadata to point to your repository, etc.
43+
44+
## Making a Release
45+
46+
To trigger a new release:
47+
48+
1. Make changes to files in `debugger/vscode-dap-extension/`
49+
2. Use [Conventional Commits](https://www.conventionalcommits.org/) format with the scope `debugger):
50+
- `feat(debugger):` for new features (bumps minor version)
51+
- `fix(debugger):` for bug fixes (bumps patch version)
52+
- `BREAKING CHANGE:` in footer for breaking changes (bumps major version)
53+
- `chore(debugger):`, `docs(debugger):`, etc. for other changes (no version bump)
54+
3. Open a PR with your changes
55+
4. Merge the PR to `main`
56+
5. Release-please will create/update a release PR
57+
6. Merge the release PR to trigger publishing
58+
59+
## Version Management
60+
61+
- Current version is tracked in `package.json`
62+
- Release-please automatically updates the version
63+
- Tags are prefixed with `v` (e.g., `v0.3.0`)
64+
65+
## Troubleshooting
66+
67+
### Publishing Fails
68+
69+
Check that:
70+
- The `VSCE_PAT` secret is valid and hasn't expired
71+
- The publisher account has proper permissions
72+
- The extension builds successfully locally with `npm run build && npm run package`
73+
74+
### No Release PR Created
75+
76+
Ensure:
77+
- Changes are in the `debugger/vscode-dap-extension/` directory
78+
- Commits follow the Conventional Commits format

release-please-config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22
"release-type": "simple",
33
"bump-minor-pre-major": false,
44
"bump-patch-for-minor-pre-major": false,
5+
"include-v-in-tag": true,
56
"packages": {
67
".": {
8+
"exclude-paths": ["debugger/vscode-dap-extension/**"]
9+
},
10+
"debugger/vscode-dap-extension": {
11+
"package-name": "starlingmonkey-debugger",
12+
"release-type": "node",
713
"include-v-in-tag": true
814
}
915
}

0 commit comments

Comments
 (0)