Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Upload and publish to Chrome Web Store | |
on: | |
push: | |
tags: | |
- v* | |
jobs: | |
upload-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "20" | |
- run: npm install | |
- run: npm run build | |
- run: zip -j -r app.zip dist | |
- name: Upload and publish | |
env: | |
CHROME_WEB_STORE_APP_ID: ${{ secrets.CHROME_WEB_STORE_APP_ID }} | |
CHROME_WEB_STORE_CLIENT_ID: ${{ secrets.CHROME_WEB_STORE_CLIENT_ID }} | |
CHROME_WEB_STORE_CLIENT_SECRET: ${{ secrets.CHROME_WEB_STORE_CLIENT_SECRET }} | |
CHROME_WEB_STORE_REFRESH_TOKEN: ${{ secrets.CHROME_WEB_STORE_REFRESH_TOKEN }} | |
run: | | |
ACCESS_TOKEN=$(curl -X POST https://oauth2.googleapis.com/token -d \ | |
"client_id=$CHROME_WEB_STORE_CLIENT_ID&client_secret=$CHROME_WEB_STORE_CLIENT_SECRET&refresh_token=$CHROME_WEB_STORE_REFRESH_TOKEN&grant_type=refresh_token" \ | |
| jq '.access_token' -r) | |
curl \ | |
-H "Authorization: Bearer $ACCESS_TOKEN" \ | |
-H "x-goog-api-version: 2" \ | |
-X PUT \ | |
-T app.zip \ | |
https://www.googleapis.com/upload/chromewebstore/v1.1/items/$CHROME_WEB_STORE_APP_ID | |
curl \ | |
-H "Authorization: Bearer $ACCESS_TOKEN" \ | |
-H "x-goog-api-version: 2" \ | |
-H "Content-Length: 0" \ | |
-H "Expect:" \ | |
-X GET \ | |
https://www.googleapis.com/chromewebstore/v1.1/items/$CHROME_WEB_STORE_APP_ID?projection=draft | |
curl \ | |
-H "Authorization: Bearer $ACCESS_TOKEN" \ | |
-H "x-goog-api-version: 2" \ | |
-H "Content-Length: 0" \ | |
-X POST \ | |
https://www.googleapis.com/chromewebstore/v1.1/items/$CHROME_WEB_STORE_APP_ID/publish |