Publish Extension to All Stores #65
Workflow file for this run
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 Extension to All Stores | |
| on: [workflow_dispatch] | |
| env: | |
| MAX_PACKAGE_SIZE: 2621440 # 2.5MB in bytes | |
| FF_MIN_VER: "140.0" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Verify branch | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/heads/main ]]; then | |
| echo "Running on main branch ✅" | |
| elif [[ "$GITHUB_REF" == refs/tags/* ]]; then | |
| git fetch origin main | |
| if git merge-base --is-ancestor HEAD origin/main; then | |
| echo "Tag is on main branch ✅" | |
| else | |
| echo "❌ Tag is not on main branch" | |
| exit 1 | |
| fi | |
| else | |
| echo "❌ Not on main branch or a tag on main" | |
| exit 1 | |
| fi | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "v24" | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Build for Chrome and Edge | |
| run: npm run build | |
| - name: Build for Firefox | |
| run: npm run build:firefox | |
| - name: Source package | |
| run: bash script/source-archive.sh | |
| - name: Check file sizes | |
| run: | | |
| # Check Chrome/Edge package size | |
| CHROME_SIZE=$(ls -l market_packages/target.zip | awk '{print $5}') | |
| echo "Chrome/Edge package: $CHROME_SIZE bytes" | |
| if [ $CHROME_SIZE -gt $MAX_PACKAGE_SIZE ]; then | |
| echo "❌ Error: Chrome/Edge package exceeds size limit" | |
| exit 1 | |
| else | |
| echo "✅ Chrome/Edge package size is within limit" | |
| fi | |
| # Check Firefox package size | |
| FIREFOX_SIZE=$(ls -l market_packages/target.firefox.zip | awk '{print $5}') | |
| echo "Firefox package: $FIREFOX_SIZE bytes" | |
| if [ $FIREFOX_SIZE -gt $MAX_PACKAGE_SIZE ]; then | |
| echo "❌ Error: Firefox package exceeds size limit" | |
| exit 1 | |
| else | |
| echo "✅ Firefox package size is within limit" | |
| fi | |
| - name: Upload Chrome/Edge Artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: chrome-edge-package | |
| path: market_packages/target.zip | |
| - name: Upload Firefox XPI Artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: firefox-xpi-package | |
| path: market_packages/target.firefox.zip | |
| - name: Upload Firefox Source Artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: firefox-source-package | |
| path: market_packages/target.src.zip | |
| publish-chrome: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download Chrome/Edge Artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: chrome-edge-package | |
| - name: Upload to Chrome Web Store | |
| uses: mnao305/chrome-extension-upload@v5.0.0 | |
| with: | |
| file-path: target.zip | |
| extension-id: dkdhhcbjijekmneelocdllcldcpmekmm | |
| client-id: ${{ secrets.CHROME_CLIENT_ID }} | |
| client-secret: ${{ secrets.CHROME_CLIENT_SECRET }} | |
| refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }} | |
| publish: true | |
| publish-edge: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download Chrome/Edge Artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: chrome-edge-package | |
| - name: Upload to Edge Add-on Store | |
| uses: wdzeng/edge-addon@v2 | |
| with: | |
| zip-path: target.zip | |
| product-id: 2a99ae83-5ec8-4ad2-aa63-9a276fc708ce | |
| client-id: ${{ secrets.EDGE_CLIENT_ID }} | |
| api-key: ${{ secrets.EDGE_API_KEY }} | |
| upload-only: false | |
| publish-firefox: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download Firefox XPI Artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: firefox-xpi-package | |
| - name: Download Firefox Source Artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: firefox-source-package | |
| - name: Upload to Firefox Add-on Store | |
| uses: wdzeng/firefox-addon@v1.2.0 | |
| with: | |
| addon-guid: "{a8cf72f7-09b7-4cd4-9aaa-7a023bf09916}" | |
| xpi-path: target.firefox.zip | |
| source-file-path: target.src.zip | |
| compatibility: | |
| '{"firefox": {"min": "${{ env.FF_MIN_VER }}"}, "android": | |
| {"min": "${{ env.FF_MIN_VER}}"}}' | |
| jwt-issuer: ${{ secrets.FIREFOX_JWD_ISSUER }} | |
| jwt-secret: ${{ secrets.FIREFOX_JWD_SECRET }} |