Publish Extensions #1
This file contains hidden or 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: Publish Extensions | |
| on: | |
| workflow_dispatch: | |
| workflow_call: | |
| jobs: | |
| publish-chrome: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - name: Build all packages | |
| run: pnpm build | |
| env: | |
| BUILD_NUMBER: ${{ github.run_number }} | |
| - name: Zip extension | |
| working-directory: packages/devtools-extension | |
| run: cd dist && zip -r ../extension-chrome.zip . | |
| - name: Upload and publish to Chrome Web Store | |
| env: | |
| EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }} | |
| CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }} | |
| CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }} | |
| REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }} | |
| run: | | |
| # Get access token | |
| TOKEN=$(curl -s -X POST https://oauth2.googleapis.com/token \ | |
| -d "client_id=$CLIENT_ID" \ | |
| -d "client_secret=$CLIENT_SECRET" \ | |
| -d "refresh_token=$REFRESH_TOKEN" \ | |
| -d "grant_type=refresh_token" | jq -r '.access_token') | |
| # Upload | |
| UPLOAD=$(curl -s \ | |
| -H "Authorization: Bearer $TOKEN" \ | |
| -H "x-goog-api-version: 2" \ | |
| -X PUT \ | |
| -T packages/devtools-extension/extension-chrome.zip \ | |
| "https://www.googleapis.com/upload/chromewebstore/v1.1/items/$EXTENSION_ID") | |
| echo "Upload response: $UPLOAD" | |
| echo "$UPLOAD" | jq -e '.uploadState == "SUCCESS"' || exit 1 | |
| # Publish to default (public) | |
| PUBLISH=$(curl -s \ | |
| -H "Authorization: Bearer $TOKEN" \ | |
| -H "x-goog-api-version: 2" \ | |
| -H "Content-Length: 0" \ | |
| -X POST \ | |
| "https://www.googleapis.com/chromewebstore/v1.1/items/$EXTENSION_ID/publish") | |
| echo "Publish response: $PUBLISH" | |
| echo "$PUBLISH" | jq -e '.status[0] == "OK"' || { echo "::error::Publish failed — see response above"; exit 1; } | |
| publish-firefox: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - name: Build all packages | |
| run: pnpm build | |
| env: | |
| BUILD_NUMBER: ${{ github.run_number }} | |
| - name: Build Firefox extension | |
| working-directory: packages/devtools-extension | |
| run: node --experimental-strip-types build.mjs --target=firefox | |
| env: | |
| BUILD_NUMBER: ${{ github.run_number }} | |
| - name: Zip extension | |
| working-directory: packages/devtools-extension | |
| run: cd dist && zip -r ../extension-firefox.zip . | |
| - name: Zip source for AMO review | |
| run: zip -r source.zip . -x 'node_modules/*' '*/node_modules/*' '*/dist/*' '.git/*' '*.zip' | |
| - name: Upload to Firefox Add-ons | |
| uses: trmcnvn/firefox-addon@0d05671269b82c69c3f22ed86d8e772e89d47cf4 # v1 | |
| with: | |
| uuid: oidc-devtool@wolfcola | |
| xpi: packages/devtools-extension/extension-firefox.zip | |
| manifest: packages/devtools-extension/dist/manifest.json | |
| api-key: ${{ secrets.AMO_JWT_ISSUER }} | |
| api-secret: ${{ secrets.AMO_JWT_SECRET }} |