Skip to content

try something else

try something else #8

name: Update Chrome Extension
on:
push:
branches:
- master
env:
SHA: ${{ github.sha }}
jobs:
build-chrome-extension:
name: Build Chrome extension artifact
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build
run: |-
npx pnpm install
npx pnpm build:chrome
# we archive the dist folder and include SHA commit as the last step
cd dist/chrome
zip -r chrome-extension-$SHA.zip ./*
mv chrome-extension-$SHA.zip ../../
cd -
- name: Archive chrome-extension artifact
uses: actions/upload-artifact@v2
with:
name: chrome-extension-${{ github.sha }}
path: chrome-extension-${{ github.sha }}.zip
# api usage reference:
# * <https://developer.chrome.com/docs/webstore/using_webstore_api/>
# * <https://github.com/fregante/chrome-webstore-upload/blob/main/How%20to%20generate%20Google%20API%20keys.md>
upload-extension:
name: Upload extension
runs-on: ubuntu-latest
needs: build-chrome-extension
env:
# you can optionally specify extension ID here, we do this so that
# all of our environments (dev, staging, prod) have a consistent ID
# we can reference. Otherwise the extension ID is autogenerated.
EXTENSION_ID: <extension id her>
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: "16.10"
- name: Download bundle artifact
uses: actions/download-artifact@v3
with:
name: chrome-extension-${{ github.sha }}
- name: Install webstore cli
run: |-
npm install -g chrome-webstore-upload-cli
- name: Upload step
run: |-
chrome-webstore-upload upload --source chrome-extension-${{ github.sha }}.zip --extension-id ${{ secrets.EXTENSION_ID }} --client-id ${{ secrets.CI_GOOGLE_CLIENT_ID }} --client-secret ${{ secrets.CI_GOOGLE_CLIENT_SECRET }} --refresh-token ${{ secrets.CI_GOOGLE_REFRESH_TOKEN }}
--auto-publish