Submit to Web Stores #14
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: "Submit to Web Stores" | |
on: | |
workflow_dispatch: | |
inputs: | |
channel: | |
description: "Release channel to publish to" | |
required: true | |
type: choice | |
options: | |
- staging | |
- production | |
default: staging | |
env: | |
CHANNEL: ${{ github.event.inputs.channel || 'staging' }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache pnpm modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.pnpm-store | |
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}- | |
- uses: pnpm/action-setup@v2.4.0 | |
with: | |
version: latest | |
run_install: true | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v3.4.1 | |
with: | |
node-version: 18.x | |
cache: "pnpm" | |
- name: Change version (Staging) | |
if: env.CHANNEL == 'staging' | |
run: | | |
DATE=$(date +'%Y%m%d') | |
BASE_VERSION=$(jq -r .version package.json | cut -d'-' -f1) | |
NEW_VERSION="${BASE_VERSION}-${DATE}" | |
jq --arg version "$NEW_VERSION" '.version = $version' package.json > package_tmp.json && mv package_tmp.json package.json | |
- name: Build the extension (Chrome) | |
run: pnpm plasmo build --target=chrome-mv3 | |
- name: Build the extension (Firefox) | |
run: pnpm plasmo build --target=firefox-mv2 | |
- name: Package the extension into zip artifacts | |
run: | | |
pnpm package --target=chrome-mv3 | |
pnpm package --target=firefox-mv2 | |
- name: Browser Platform Publish (staging) | |
uses: PlasmoHQ/bpp@v3 | |
if: env.CHANNEL == 'staging' | |
with: | |
keys: ${{ secrets.SUBMIT_KEYS_STAGING }} | |
verbose: true | |
chrome-file: build/chrome-mv3-prod.zip | |
firefox-file: build/firefox-mv2-prod.zip | |
- name: Browser Platform Publish (production) | |
uses: PlasmoHQ/bpp@v3 | |
if: env.CHANNEL == 'production' | |
with: | |
keys: ${{ secrets.SUBMIT_KEYS_PRODUCTION }} | |
verbose: true | |
chrome-file: build/chrome-mv3-prod.zip | |
firefox-file: build/firefox-mv2-prod.zip |