Skip to content

Publish extension to Chrome and Firefox #68

Publish extension to Chrome and Firefox

Publish extension to Chrome and Firefox #68

Workflow file for this run

name: Publish extension to Chrome and Firefox
on:
workflow_dispatch:
inputs:
targetStore:
description: 'Store target'
required: true
default: 'all'
type: choice
options:
- chrome
- firefox
- all
autoTag:
description: 'Auto Create a new tag'
required: true
default: true
type: boolean
testMode:
description: 'Test Mode'
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 }}
jobs:
tag_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Bump version and push tag
id: tag_version
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DRY_RUN: ${{ github.event.inputs.autoTag == 'false' }}
- name: Update manifest.json
if: github.event.inputs.autoTag == 'true'
run: |
new_version=$(echo "${{ steps.tag_version.outputs.new_tag }}" | sed 's/^v//')
jq --arg version "$new_version" '.version = $version' public/base.manifest.json > public/base.manifest.json.tmp && mv public/base.manifest.json.tmp public/base.manifest.json
- name: Commit changes
if: github.event.inputs.autoTag == 'true'
uses: EndBug/add-and-commit@v5
with:
branch: master
author_name: Github bot
author_email: [email protected]
message: 'Bump manifest version'
chrome-deploy:
if: ${{ (github.event.inputs.targetStore == 'chrome') || (github.event.inputs.targetStore == 'all') }}
needs: tag_version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: master
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install yarn dependencies
run: yarn
- name: Build and zip the extension
run: yarn build:chrome
- name: Upload the package to Chrome web store
if: ${{ github.event.inputs.testMode == 'false' }}
run: npx chrome-webstore-upload-cli@2 upload --source chrome_extension.zip --extension-id $EXTENSION_ID --auto-publish
env:
EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
CLIENT_ID: ${{secrets.CHROME_EXTENSION_CLIENT_ID}}
REFRESH_TOKEN: ${{secrets.CHROME_EXTENSION_REFRESH_TOKEN}}
CLIENT_SECRET: ${{secrets.CHROME_EXTENSION_CLIENT_SECRET}}
firefox-deploy:
if: ${{ (github.event.inputs.targetStore == 'firefox') || (github.event.inputs.targetStore == 'all') }}
needs: tag_version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: master
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install yarn dependencies
run: yarn
- name: Build and zip the extension
run: yarn build:firefox
- name: Upload the package to Firefox web store
if: ${{ github.event.inputs.testMode == 'false' }}
uses: yayuyokitano/[email protected]
with:
api_key: ${{ secrets.WEB_EXT_API_KEY }}
api_secret: ${{ secrets.WEB_EXT_API_SECRET }}
guid: '{f8793186-e9da-4332-aa1e-dc3d9f7bb04c}'
xpi_path: firefox_extension.zip
src_path: source_code.zip