# Publish a Chrome Extension to the Chrome Web Store from GitHub Actions

Yes. An agent adds a workflow that builds your extension on a tag, zips the dist directory and uploads it to the Chrome Web Store through its API, then opens a PR.

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

## What the agent does

The agent clones the extension into its own cloud sandbox and reads how it is built before it writes any YAML. In a project like chibat/chrome-extension-typescript-starter, `package.json` is at version `1.0.0` with scripts `build` (`webpack --config webpack/webpack.prod.js`), `watch`, `clean` (`rimraf dist`), `test` (`npx jest`) and `style`; the toolchain is TypeScript 5.0.4, webpack 5.94 through `ts-loader` 8, React 18 and Jest 29, with a committed `package-lock.json`. `webpack/webpack.common.js` has four entries, `popup`, `options`, `background` and `content_script`, writes them to `dist/js/`, splits shared code into `vendor.js` for every chunk except the background service worker, and a `CopyPlugin` copies everything in `public/` to the root of `dist/`. That makes `dist/` the loadable extension: `public/manifest.json` (Manifest V3, `"version": "1.0"`, an `options_ui` page, an `action` popup, a content script on `<all_urls>`, a `background.service_worker` at `js/background.js`, the `storage` permission and `<all_urls>` as `host_permissions`) lands beside `popup.html`, `options.html` and `icon.png`. `.gitignore` excludes `dist/`, and the only workflow, `.github/workflows/build.yml`, runs `npm ci`, `npm run build --if-present` and `npm test` on Node 20 and 22 for every push and pull request to `main`.

Two facts shape the workflow. The Chrome Web Store API can only update an item that already exists, so the first upload is a person's job in the developer dashboard, and the workflow takes the resulting 32-character item id as a secret. And the API signs in with an OAuth client, not an API key: a client id and client secret from a Google Cloud project with the Chrome Web Store API enabled, plus a refresh token minted once for the developer account. The agent writes `.github/workflows/publish.yml` that runs on tags matching `v*`, reuses the Node version and the `npm ci` and `npm run build` steps from `build.yml`, runs `npm test` so a release never ships what CI would have refused, and then packages `dist/` with `cd dist && zip -r ../extension.zip .` so `manifest.json` sits at the root of the archive, which is where the store expects it.

The upload step uses the `chrome-webstore-upload-cli` package, pinned, with `--source extension.zip --extension-id`, `--client-id`, `--client-secret` and `--refresh-token` read from a GitHub environment named `chrome-web-store`, so the secrets are scoped to this one workflow and can require a reviewer before they are released to the job. Publishing is a separate call from uploading, and the agent keeps it that way: an `auto_publish` input on `workflow_dispatch` decides whether the job runs `publish` after `upload`, and a tag push uploads only, leaving the item in the dashboard for a person to submit. The workflow fails early if the tag does not match the manifest: a step reads `version` from `public/manifest.json` with `node -p` and compares it with the tag, which is also where the agent notes that the manifest says `1.0` while `package.json` says `1.0.0`, and proposes the manifest as the single source of truth because that is the number the store shows.

Everything that can be checked without the store's credentials is checked in the sandbox. The agent runs `npm ci`, `npm run build` and `npm test`, zips `dist/`, lists the archive to show `manifest.json` at its top level, parses the manifest to confirm the version field, and runs `actionlint` over the new workflow. It does not and cannot call the Web Store API, because the sandbox holds no client secret or refresh token; the pull request says exactly that and lists the four secrets and the one manual first upload the reader must do before the first tag.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "Add a GitHub Actions workflow that publishes this Chrome extension to the Chrome Web Store. Read package.json, the webpack configs, public/manifest.json, .gitignore and the existing workflow under .github/workflows first, and reuse the Node version, install, build and test steps CI already uses. Write .github/workflows/publish.yml that runs on tags matching v* and on workflow_dispatch with an auto_publish boolean input: build, run the tests, fail if the tag does not equal the version in public/manifest.json, zip the dist directory with manifest.json at the archive root, and upload the zip with chrome-webstore-upload-cli using EXTENSION_ID, CLIENT_ID, CLIENT_SECRET and REFRESH_TOKEN from a GitHub environment named chrome-web-store; publish only when auto_publish is true. Do not call the Web Store API from here. Run the build and tests, inspect the zip, lint the workflow, and open a pull request that lists the secrets to create, explains that the first upload must be done by hand in the developer dashboard, and notes the manifest and package.json version mismatch.",
  "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 adding `.github/workflows/publish.yml` and a short section in `README.md` on cutting a release: bump `version` in `public/manifest.json`, tag `v<version>`, push the tag, and either let the upload sit in the dashboard or dispatch the workflow with `auto_publish` to submit it for review. The description lists the four secrets by name, says which GitHub environment holds them, and walks through creating the OAuth client and refresh token once.

The run's record keeps the sandbox output a reviewer wants to see before trusting the workflow: the webpack build, the Jest run, the `unzip -l` listing that shows `manifest.json`, `popup.html`, `options.html`, `icon.png` and the `js/` bundles at the root of the archive, and the `actionlint` pass over the new file.

Before merging, a reviewer creates the `chrome-web-store` environment with its secrets, confirms the item id matches the listing they uploaded by hand, and decides whether tags should upload only or also publish. A first tag on a throwaway version is the real test, and the store's own review is the step after that.

## Run it on every extension release

A developer hands this off from the terminal once per extension: one `POST /o/{org}/sessions` with this body and the repository in `resources`, and the laptop is free while the agent reads the build, writes the workflow and proves the zip. A team that maintains several extensions sends one request per repository, each with a `request_id` that is a UUID v5 of the repository path so a retried call returns the run it already started, and the key's `webhook_url` reports each finished run with its pull request.

After that, every release is the tag. The workflow the agent wrote does the upload, and each run of it is visible in the repository's Actions tab with the zip listing and the store's response.

## Why run it on Rush?

Store publishing is the kind of job nobody wants to debug on a laptop: an OAuth client that must be created in the right Google Cloud project, a refresh token minted once, a zip whose layout the store checks silently, and a version string that lives in two files. The agent reads the real build in its own sandbox, runs it, packages exactly what webpack produced and keeps every command and its output, so a reviewer sees the archive the store will receive before any secret exists.

The same request works for any Manifest V3 extension built by a script, whatever the bundler. Each run reads that repository's own manifest, scripts and workflow and writes a publish workflow that fits them, and the pull request carries the proof that the package is correct up to the point where only the store's credentials can go further.

## Frequently asked questions

### Can the workflow create the store listing for us?

No. The Chrome Web Store API updates existing items only, so the very first upload is done by a person in the developer dashboard. That upload produces the item id the workflow needs as `EXTENSION_ID`; every later version can go through the API.

### Which secrets do we need, and where do they come from?

Four: the item id from the dashboard, and an OAuth client id, client secret and refresh token from a Google Cloud project with the Chrome Web Store API enabled. The refresh token is minted once for the account that owns the listing. The pull request puts all four in a GitHub environment so they are released only to this workflow.

### Will a tag push publish the extension immediately?

Not as written. A tag uploads the new version and leaves it in the dashboard; publishing is a second call that the workflow makes only when dispatched by hand with `auto_publish` set. The reader can flip that default in one line once they trust the pipeline.

### Does this change how the extension is built?

No. The workflow runs the same `npm ci`, `npm run build` and `npm test` as the existing `build.yml` and zips the `dist/` directory webpack already produces. The only source change proposed is making `public/manifest.json` the one place the version lives, since it is what the store reads.

### Why does the manifest's host permission matter here?

Because `<all_urls>` in `host_permissions` puts every upload into a longer store review and asks users for broad access on install. The agent does not change it, but the pull request points it out, since narrowing it to the sites the content script needs is the single change most likely to shorten review.

## More Chrome Extension jobs

- [Convert a Chrome Extension From JavaScript to TypeScript](https://getrush.ai/run/convert-javascript-to-typescript/chrome-extension/)
- [Migrate a Chrome Extension from Jest to Vitest](https://getrush.ai/run/migrate-jest-to-vitest/chrome-extension/)
- [Replace setTimeout Polling With chrome.alarms in a Chrome Extension](https://getrush.ai/run/migrate-to-chrome-alarms/chrome-extension/)

## More jobs like this: Hand off a long task

- [Add a GitHub Webhook Receiver to a Flux Cluster](https://getrush.ai/run/add-webhook-receiver/flux/)
- [Add WebSockets to an aiohttp App](https://getrush.ai/run/add-websockets/aiohttp/)
- [Add WebSockets to a Cloudflare Worker with Durable Objects](https://getrush.ai/run/add-websockets/cloudflare-workers/)

## 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/)
