🚀 Distribute browser extension #102
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: '🚀 Deploy browser extension' | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| target: | |
| description: 'Which store to deploy to?' | |
| required: true | |
| default: 'all' | |
| type: choice | |
| options: | |
| - chrome | |
| - firefox | |
| - all | |
| testMode: | |
| description: 'Run in test mode without publishing?' | |
| required: true | |
| default: false | |
| type: boolean | |
| env: | |
| VITE_BUILD_TARGET: 'extension' | |
| VITE_AMPLITUDE_KEY: ${{ secrets.REACT_APP_AMPLITUDE_KEY }} | |
| VITE_AMPLITUDE_URL: ${{ secrets.REACT_APP_AMPLITUDE_URL }} | |
| VITE_API_URL: ${{ secrets.API_URL }} | |
| VITE_FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }} | |
| VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }} | |
| VITE_SENTRY_TOKEN: ${{ secrets.VITE_SENTRY_TOKEN }} | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| browser: [chrome, firefox] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| cache: 'yarn' | |
| - run: yarn install --frozen-lockfile | |
| - name: 'Build Extension' | |
| if: ${{ github.event.inputs.target == 'all' || github.event.inputs.target == matrix.browser }} | |
| run: yarn build:${{ matrix.browser }} | |
| - name: '⬆️ Upload to Chrome Web Store' | |
| if: ${{ (github.event.inputs.target == 'all' || github.event.inputs.target == 'chrome') && matrix.browser == 'chrome' && github.event.inputs.testMode == 'false' }} | |
| run: > | |
| npx chrome-webstore-upload-cli@3 upload | |
| --source chrome_extension.zip | |
| --extension-id ${{ secrets.CHROME_EXTENSION_ID }} | |
| --auto-publish | |
| env: | |
| EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }} | |
| CLIENT_ID: ${{ secrets.CHROME_EXTENSION_CLIENT_ID }} | |
| CLIENT_SECRET: ${{ secrets.CHROME_EXTENSION_CLIENT_SECRET }} | |
| REFRESH_TOKEN: ${{ secrets.CHROME_EXTENSION_REFRESH_TOKEN }} | |
| - name: '⬆️ Upload to Firefox Add-on Store' | |
| if: ${{ (github.event.inputs.target == 'all' || github.event.inputs.target == 'firefox') && matrix.browser == 'firefox' && github.event.inputs.testMode == 'false' }} | |
| uses: wdzeng/firefox-addon@v1 | |
| with: | |
| jwt-issuer: ${{ secrets.WEB_EXT_API_KEY }} | |
| jwt-secret: ${{ secrets.WEB_EXT_API_SECRET }} | |
| addon-guid: '{f8793186-e9da-4332-aa1e-dc3d9f7bb04c}' | |
| xpi-path: firefox_extension.zip | |
| source-file-path: source_code.zip |