Commit d27b6e1
feat(ci): add upload-extension-to-cws workflow for CWS submission (#42774)
## **Description**
Adds `upload-extension-to-cws.yml`, a `workflow_dispatch`-only GitHub
Actions workflow that uploads `metamask-chrome-{version}.zip` from
GitHub Releases to the Chrome Web Store using **GCP Workload Identity
Federation** (no refresh tokens in GitHub Secrets).
**Why:** Replaces manual CWSS upload with an auditable, keyless pipeline
([INFRA-3646](https://consensyssoftware.atlassian.net/browse/INFRA-3646),
epic
[INFRA-2565](https://consensyssoftware.atlassian.net/browse/INFRA-2565)).
**How:**
- Inputs: `version` (semver) + `target` (`beta` | `production`, default
`beta`)
- Resolves `*_BETA` or production repo **variables** per target
- WIF auth via pinned `google-github-actions/auth` **v3.0.0**, then
`curl` PUT to CWS (update only — does not publish live)
- Beta: strips `manifest.json` `key` before upload (POC lesson for dev
listing)
- Production: requires `cws-production` environment + `main` branch ref
- Concurrency group per workflow/ref/target (no cancel-in-progress)
Runway sender verification is **out of scope** for this PR
([INFRA-3649](https://consensyssoftware.atlassian.net/browse/INFRA-3649)).
**Beta E2E (validated on this branch):** [Actions run
26119853507](https://github.com/MetaMask/metamask-extension/actions/runs/26119853507)
— `target=beta`, `version=13.31.0`, HTTP **200**, `uploadState:
SUCCESS`, dev extension `beknelapmjpgbnafpmjnhjekjdbhbnbk` (not
published to users). Validated via a temporary PR trigger that has been
**removed**; merge-ready workflow is `workflow_dispatch` only.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes:
[INFRA-3646](https://consensyssoftware.atlassian.net/browse/INFRA-3646)
Related:
[INFRA-3645](https://consensyssoftware.atlassian.net/browse/INFRA-3645)
(beta WIF + variables),
[INFRA-3644](https://consensyssoftware.atlassian.net/browse/INFRA-3644)
(production WIF + variables)
## **Manual testing steps**
**Prerequisites (repo admin):**
1. GitHub Environment **`cws-beta`** (no required reviewers for beta).
2. `*_BETA` repo variables set (INFRA-3645).
3. WIF trusts `MetaMask/metamask-extension`; SA is manager on dev CWS
item `beknelapmjpgbnafpmjnhjekjdbhbnbk`.
**Beta test (completed):**
1. [Run
26119853507](https://github.com/MetaMask/metamask-extension/actions/runs/26119853507)
— success on dev listing.
2. After merge: Actions → **Upload extension to Chrome Web Store** → Run
workflow from `main` (or feature branch for beta).
3. `version`: must match an existing release asset
`metamask-chrome-{version}.zip` on tag `v{version}`.
4. `target`: `beta` (default).
5. Expect HTTP 200; package pending in CWS dev console (upload only).
**Post-merge / follow-up:**
- Production E2E + `cws-production` environment
([INFRA-3644](https://consensyssoftware.atlassian.net/browse/INFRA-3644)).
- Optional: remove repo variable `CWS_PR_TEST_VERSION` if it was added
only for PR testing.
## **Screenshots/Recordings**
N/A — CI workflow only (no UI change).
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable — N/A (workflow-only; E2E is
manual dispatch)
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable — N/A
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
[INFRA-3646]:
https://consensyssoftware.atlassian.net/browse/INFRA-3646?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[INFRA-2565]:
https://consensyssoftware.atlassian.net/browse/INFRA-2565?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[INFRA-3649]:
https://consensyssoftware.atlassian.net/browse/INFRA-3649?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Adds a new privileged GitHub Actions workflow that can upload
extension packages to the Chrome Web Store using OIDC/WIF;
misconfiguration of repo variables/environments or misuse of manual
dispatch could publish unintended builds (though it only uploads as
draft).
>
> **Overview**
> Introduces a new `workflow_dispatch` GitHub Actions workflow
(`.github/workflows/upload-extension-to-cws.yml`) to **upload a release
ZIP from GitHub Releases to the Chrome Web Store** using **GCP Workload
Identity Federation** (OIDC), avoiding long-lived secrets.
>
> The workflow validates `version`/`target`, selects beta vs production
repository variables and environment, optionally strips `manifest.json`
`key` for beta uploads, then calls the CWS API v2 upload endpoint and
polls `fetchStatus` until completion, emitting a run summary
(upload-only; not published to users).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
ce8d7ce. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 6103209 commit d27b6e1
1 file changed
Lines changed: 246 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
0 commit comments