Skip to content

Commit 2ab3df3

Browse files
authored
Merge pull request #32 from ryanbas21/fix/cws-publish-debug
fix: replace CWS upload action with direct API calls
2 parents 121e549 + 931fd0c commit 2ab3df3

2 files changed

Lines changed: 65 additions & 18 deletions

File tree

.github/workflows/publish-extension.yml

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,39 @@ jobs:
2828
working-directory: packages/devtools-extension
2929
run: cd dist && zip -r ../extension-chrome.zip .
3030

31-
- name: Upload to Chrome Web Store
32-
uses: mnao305/chrome-extension-upload@4008e29e13c144d0f6725462cbd49b7c291b4928 # v5.0.0
33-
with:
34-
file-path: packages/devtools-extension/extension-chrome.zip
35-
extension-id: ${{ secrets.CHROME_EXTENSION_ID }}
36-
client-id: ${{ secrets.CHROME_CLIENT_ID }}
37-
client-secret: ${{ secrets.CHROME_CLIENT_SECRET }}
38-
refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }}
39-
publish: true
31+
- name: Upload and publish to Chrome Web Store
32+
env:
33+
EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
34+
CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
35+
CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
36+
REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
37+
run: |
38+
# Get access token
39+
TOKEN=$(curl -s -X POST https://oauth2.googleapis.com/token \
40+
-d "client_id=$CLIENT_ID" \
41+
-d "client_secret=$CLIENT_SECRET" \
42+
-d "refresh_token=$REFRESH_TOKEN" \
43+
-d "grant_type=refresh_token" | jq -r '.access_token')
44+
45+
# Upload
46+
UPLOAD=$(curl -s \
47+
-H "Authorization: Bearer $TOKEN" \
48+
-H "x-goog-api-version: 2" \
49+
-X PUT \
50+
-T packages/devtools-extension/extension-chrome.zip \
51+
"https://www.googleapis.com/upload/chromewebstore/v1.1/items/$EXTENSION_ID")
52+
echo "Upload response: $UPLOAD"
53+
echo "$UPLOAD" | jq -e '.uploadState == "SUCCESS"' || exit 1
54+
55+
# Publish to default (public)
56+
PUBLISH=$(curl -s \
57+
-H "Authorization: Bearer $TOKEN" \
58+
-H "x-goog-api-version: 2" \
59+
-H "Content-Length: 0" \
60+
-X POST \
61+
"https://www.googleapis.com/chromewebstore/v1.1/items/$EXTENSION_ID/publish")
62+
echo "Publish response: $PUBLISH"
63+
echo "$PUBLISH" | jq -e '.status[0] == "OK"' || { echo "::error::Publish failed — see response above"; exit 1; }
4064
4165
publish-firefox:
4266
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,38 @@ jobs:
5454

5555
- name: Publish Chrome extension to testers
5656
if: inputs.extension
57-
uses: mnao305/chrome-extension-upload@4008e29e13c144d0f6725462cbd49b7c291b4928 # v5.0.0
58-
with:
59-
file-path: packages/devtools-extension/extension-chrome.zip
60-
extension-id: ${{ secrets.CHROME_EXTENSION_ID }}
61-
client-id: ${{ secrets.CHROME_CLIENT_ID }}
62-
client-secret: ${{ secrets.CHROME_CLIENT_SECRET }}
63-
refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }}
64-
publish: true
65-
publish-target: trustedTesters
57+
env:
58+
EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
59+
CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
60+
CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
61+
REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
62+
run: |
63+
# Get access token
64+
TOKEN=$(curl -s -X POST https://oauth2.googleapis.com/token \
65+
-d "client_id=$CLIENT_ID" \
66+
-d "client_secret=$CLIENT_SECRET" \
67+
-d "refresh_token=$REFRESH_TOKEN" \
68+
-d "grant_type=refresh_token" | jq -r '.access_token')
69+
70+
# Upload
71+
UPLOAD=$(curl -s \
72+
-H "Authorization: Bearer $TOKEN" \
73+
-H "x-goog-api-version: 2" \
74+
-X PUT \
75+
-T packages/devtools-extension/extension-chrome.zip \
76+
"https://www.googleapis.com/upload/chromewebstore/v1.1/items/$EXTENSION_ID")
77+
echo "Upload response: $UPLOAD"
78+
echo "$UPLOAD" | jq -e '.uploadState == "SUCCESS"' || exit 1
79+
80+
# Publish to trusted testers
81+
PUBLISH=$(curl -s \
82+
-H "Authorization: Bearer $TOKEN" \
83+
-H "x-goog-api-version: 2" \
84+
-H "Content-Length: 0" \
85+
-X POST \
86+
"https://www.googleapis.com/chromewebstore/v1.1/items/$EXTENSION_ID/publish?publishTarget=trustedTesters")
87+
echo "Publish response: $PUBLISH"
88+
echo "$PUBLISH" | jq -e '.status[0] == "OK"' || { echo "::error::Publish failed — see response above"; exit 1; }
6689
6790
- name: Build Firefox extension
6891
if: inputs.extension

0 commit comments

Comments
 (0)