# Add a Release Workflow for a VS Code Extension

Yes. An agent adds a GitHub Actions workflow that packages your VS Code extension on every push and publishes the .vsix to the Marketplace and Open VSX on a tag.

[Run this on Rush](https://cloud.getrush.ai/run/add-release-workflow/vscode-extension/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads how the extension is built and shipped today. In an extension shaped like usernamehw/vscode-error-lens, package.json names the publisher `usernamehw`, the id `errorlens`, version 3.30.0 and `engines.vscode` of `^1.107.0` with `engines.npm` of `>=10.0.0`; `main` and `browser` both point at ./dist/extension.js, so one bundle serves desktop and web. The only build script is `vscode:prepublish`, which runs `webpack --mode production --color --devtool hidden-source-map` over src/extension.ts through ts-loader, and `watch` for development. .vscodeignore drops src/**, webpack.config.js, node_modules and the source maps from the package, .gitignore ignores dist, out and *.vsix, and there is no .github directory at all: no CI, no release, every version has been packaged on a laptop. CHANGELOG.md has one heading per version in the form `## 3.30.0` followed by the date, and README.md carries an Open VSX badge, so the extension is published in two registries.

It writes .github/workflows/release.yml with two jobs. `package` runs on every push and pull request: checkout, `actions/setup-node` with npm caching, `npm ci`, `npx eslint src --ext .ts` using the repository's .eslintrc.json, then `npx @vscode/vsce package`, which triggers `vscode:prepublish` and so the production webpack build, and uploads the resulting errorlens-<version>.vsix as a workflow artifact so a reviewer can install it from any pull request. The repository pins no Node version in a .nvmrc or `engines.node`, so the agent picks a current LTS, writes it in the workflow and says so in the pull request rather than leaving the choice implicit.

`publish` runs only on a tag that starts with `v`, needs `package`, and begins with a guard: it reads `version` from package.json and fails if the tag does not match, so a tag pushed against the wrong commit publishes nothing. It then extracts the matching section from CHANGELOG.md by its heading, creates a GitHub release with that text and the .vsix attached, and publishes the same file with `vsce publish --packagePath` using a `VSCE_PAT` secret and `npx ovsx publish` using an `OVSX_PAT` secret. Publishing the already-built file rather than rebuilding means the Marketplace, Open VSX and the GitHub release all carry byte-identical packages. The workflow sets `permissions: contents: write` on the publish job only.

The agent proves what it can without the tokens. In the sandbox it runs `npm ci` and `npx @vscode/vsce package`, checks that the package lists dist/extension.js and the img and docs the README links, and that nothing from src/ or node_modules leaked in, with `npx @vscode/vsce ls`. It runs `vsce publish --dry-run` style checks where the tool offers them and the ESLint step, and it validates the workflow with actionlint. The two secrets cannot be created by an agent; the pull request lists them by name with where each token comes from.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add a release workflow for this VS Code extension. Read package.json, webpack.config.js, tsconfig.json, .vscodeignore, .gitignore, .eslintrc.json, CHANGELOG.md and README.md first; there is no .github directory yet. Write .github/workflows/release.yml with a package job on every push and pull request that runs npm ci, eslint over src with the repository config and npx @vscode/vsce package, and uploads the .vsix as an artifact, and a publish job on tags starting with v that fails unless the tag equals the version in package.json, creates a GitHub release with the matching CHANGELOG.md section and the .vsix attached, publishes that same file with vsce publish --packagePath using a VSCE_PAT secret and with ovsx publish using an OVSX_PAT secret, and grants contents write only to that job. Choose a current LTS Node version and state it. In the sandbox run npm ci, the ESLint step, vsce package and vsce ls, confirm src and node_modules are not in the package, and run actionlint on the workflow. Open a pull request that names the two secrets the owner must add and quotes the package listing.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request on its own branch adding .github/workflows/release.yml and nothing in src/. The description explains the two jobs, the tag-equals-version guard, the Node version chosen and why, and lists `VSCE_PAT` and `OVSX_PAT` with a sentence each on where to create the token: a Marketplace personal access token for the publisher, and an Open VSX access token for the namespace.

The evidence is the sandbox output: `npx @vscode/vsce ls` showing the files in the package, the ESLint step passing, the `vsce package` output naming the .vsix, and actionlint reporting no problems. Nothing is claimed about publishing, because no token was present; the first tag after the merge is the real test and the package job already runs on the pull request itself.

Before merging, a reviewer downloads the .vsix artifact from the pull request's workflow run and installs it with `code --install-extension`, adds the two secrets, and checks that the CHANGELOG extraction picks the right section for the current heading style. Then the release is `git tag v3.31.0 && git push --tags` from the commit that bumped package.json.

## Run it on every extension released by hand

An author with more than one extension starts one run per repository: a `POST /o/{org}/sessions` with this prompt and that repository in `resources`, with a `request_id` per repository so a retried request does not open a second pull request. Each run reads its own package.json, bundler and changelog style, so an extension built with esbuild or one without a browser entry gets a workflow written for that layout.

Give the key a webhook URL and Rush posts `run.completed` or `run.failed` when each turn ends, with `session_url` for the record. After the first tagged release, a follow-up on the same session can add a pre-release channel with `vsce publish --pre-release` or a nightly build, with the branch and installed modules still in the parked sandbox.

## Why run it on Rush?

A release workflow is only trusted after it has packaged the real extension, and packaging here means a production webpack build, the .vscodeignore rules and vsce's own checks on the manifest, the LICENSE and the README. The agent runs all of that in its own sandbox, reads the package listing, and fixes what the tool reports before the workflow ever runs on GitHub, so the first pull request is not a round of yaml-by-trial.

The record stays with the pull request: every command, the package listing, the actionlint output and the reasoning behind the Node version and the tag guard are in the run's transcript. The tokens stay with the owner; the agent never sees a Marketplace credential, and the workflow it writes reads them only from repository secrets on a tag.

## Frequently asked questions

### Can the agent publish the first release itself?

No. Publishing needs a Marketplace personal access token and an Open VSX token that belong to the publisher, and the agent has neither. It writes the workflow to read them from VSCE_PAT and OVSX_PAT secrets, proves packaging in the sandbox, and leaves the first tag to the owner.

### Why package on every push if it only publishes on tags?

So the production webpack build and vsce's manifest checks run on each pull request, and so a reviewer can install the exact .vsix from the workflow artifact. Without that, the first signal that a change broke packaging would be a failed release.

### What stops a tag from publishing the wrong version?

The publish job compares the tag with the version field in package.json and fails before any upload when they differ. A tag pushed against a commit that forgot the version bump produces a red run and nothing in either registry.

### Does it also publish to Open VSX?

Yes, with ovsx publish on the same .vsix, because the README's Open VSX badge shows the extension is already listed there. If a project is Marketplace-only, say so in the prompt and the step and its secret are left out.

### Will the workflow run the extension's tests?

This extension has no test script, so the package job runs ESLint and the build. If a repository has @vscode/test-electron or @vscode/test-web set up, the agent adds that step with xvfb where the runner needs it.

## More VS Code extension jobs

- [Add Telemetry to a VS Code Extension](https://getrush.ai/run/add-telemetry/vscode-extension/)
- [Add a Tree View to a VS Code Extension](https://getrush.ai/run/add-tree-view/vscode-extension/)
- [Add a Getting Started Walkthrough to a VS Code Extension](https://getrush.ai/run/add-walkthrough/vscode-extension/)

## The same job on other stacks

- [Add a Release Workflow for a Chrome Extension](https://getrush.ai/run/add-release-workflow/chrome-extension/)
- [Add a GitHub Release Workflow With CPack Packages to a CMake Project](https://getrush.ai/run/add-release-workflow/cmake/)
- [Add a Release Workflow to an Elixir Library](https://getrush.ai/run/add-release-workflow/elixir/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
