Publish to CWS & Addons #9
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: Publish to CWS & Addons | |
on: | |
workflow_dispatch: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build Distributable Package | |
run: pnpm build | |
- name: Archive Extension Files | |
run: | | |
function create_zip { | |
# $1: target browser | |
if [ "$1" == "firefox" ]; then | |
jq ' | |
.background = { | |
"type": "module", | |
"scripts": ["background.js"] | |
} | | |
.browser_specific_settings = { | |
"gecko": { | |
"id": "[email protected]", | |
"strict_min_version": "112.0" | |
} | |
} | |
' dist/manifest.json > dist/manifest.temp.json && mv dist/manifest.temp.json dist/manifest.json | |
fi | |
cd dist && zip -r "../chorus-$1.zip" . && cd .. | |
} | |
create_zip chrome | |
create_zip firefox | |
- name: Chrome Upload & Publish | |
uses: cdrani/chrome-extension-upload@ci/silent-update-fail | |
with: | |
silent-fail: true | |
file-path: chorus-chrome.zip | |
client-id: ${{ secrets.CLIENT_ID }} | |
extension-id: ${{ secrets.EXTENSION_ID }} | |
client-secret: ${{ secrets.CLIENT_SECRET }} | |
refresh-token: ${{ secrets.REFRESH_TOKEN }} | |
- name: FireFox Upload & Publish | |
uses: yayuyokitano/[email protected] | |
with: | |
guid: '[email protected]' | |
xpi_path: chorus-firefox.zip | |
api_key: ${{ secrets.AMO_ISSUER }} | |
api_secret: ${{ secrets.AMO_SECRET }} |