Skip to content

Commit

Permalink
resolved #58: [MV3] CI deployment / publish workflow for chrome and edge
Browse files Browse the repository at this point in the history
* added ci deployment for auto publishing extensions

* changed to use non-bpp workflows until bpp has upload option in edge-addon-api

* changed to use non-bpp workflows until bpp has upload option in edge-addon-api

* added paths on build-test so not to run test everytime
  • Loading branch information
eric2788 authored Mar 4, 2024
1 parent c1f279b commit 23ade45
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 10 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ on:
- 'develop'
- 'hotfix/**'
- 'feature/**'
paths:
- 'src/**'
- 'test/**'
- 'playwright.config.ts'
- 'pnpm-lock.yaml'
- '.github/workflows/build-test.yml'
pull_request:
branches: [develop]
workflow_dispatch:
Expand Down Expand Up @@ -33,7 +39,7 @@ jobs:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
run: pnpm install --frozen-lockfile
- name: Build And Package Extensions
run: pnpm build --zip --target=${{ matrix.browser }}-mv3
# upload to github artifacts for each browser with matrix
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/publish-bpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Publish Extensions (unused)

on:
workflow_dispatch:
inputs:
dry-run:
description: 'dry run mode, will upload to the store but not publish and turn on verbose logging'
required: false
type: boolean
default: false

jobs:
build:
if: false # due to BPP edge-addon-api has no upload only option, hold this action for now
runs-on: ubuntu-latest
strategy:
matrix:
browser: [chrome, edge]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build And Package Extensions
run: pnpm build --zip --target=${{ matrix.browser }}-mv3
- name: Upload to GitHub Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.browser }}-mv3
path: build/
publish:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: build/
- name: Browser Platform Publish
uses: PlasmoHQ/bpp@v3
with:
verbose: ${{ inputs.dry-run }}
keys: |
{
"$schema": "https://raw.githubusercontent.com/plasmo-corp/bpp/v3/keys.schema.json",
"chrome": {
"zip": "build/chrome-mv3.zip",
"clientId": "${{ secrets.CHROME_CLIENT_ID }}",
"clientSecret": "${{ secrets.CHROME_CLIENT_SECRET }}",
"refreshToken": "${{ secrets.CHROME_REFRESH_TOKEN }}",
"extId": "nhomlepkjglilcahfcfnggebkaabeiog",
"uploadOnly": ${{ inputs.dry-run }}
},
"edge": {
"zip": "build/edge-mv3.zip",
"clientId": "${{ secrets.EDGE_CLIENT_ID }}",
"clientSecret": "${{ secrets.EDGE_CLIENT_SECRET}}",
"productId": "${{ secrets.EDGE_PRODUCT_ID }}",
"accessTokenUrl": "${{ secrets.EDGE_ACCESS_TOKEN_URL }}"
}
}
45 changes: 36 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Publish Extensions
on:
workflow_dispatch:
inputs:
dry-run:
description: 'dry run mode, will upload to the store but not publish'
type: boolean
required: false
default: true

jobs:
build:
Expand All @@ -19,26 +25,47 @@ jobs:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
run: pnpm install --frozen-lockfile
- name: Build And Package Extensions
run: pnpm build --zip --target=${{ matrix.browser }}-mv3
# upload to github artifacts for each browser with matrix
- name: Upload to GitHub Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.browser }}-mv3.zip
name: ${{ matrix.browser }}-mv3
path: build/
publish:
publish-chrome:
runs-on: ubuntu-latest
needs: build
steps:
# download artifacts
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: chrome-mv3
path: build/
# publish with BPP
- name: Browser Platform Publish
uses: PlasmoHQ/bpp@v3
- name: Upload Extension
uses: mnao305/[email protected]
with:
keys: ${{ secrets.SUBMIT_KEYS }}
file-path: build/chrome-mv3-prod.zip
extension-id: nhomlepkjglilcahfcfnggebkaabeiog
client-id: ${{ secrets.CHROME_CLIENT_ID }}
client-secret: ${{ secrets.CHROME_CLIENT_SECRET }}
refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }}
publish: ${{ !inputs.dry-run }}
publish-edge:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: edge-mv3
path: build/
- name: Upload Extension
uses: wdzeng/edge-addon@v1
with:
product-id: ${{ secrets.EDGE_PRODUCT_ID }}
zip-path: build/edge-mv3-prod.zip
client-id: ${{ secrets.EDGE_CLIENT_ID }}
client-secret: ${{ secrets.EDGE_CLIENT_SECRET }}
access-token-url: ${{ secrets.EDGE_ACCESS_TOKEN_URL }}
upload-only: ${{ inputs.dry-run }}

0 comments on commit 23ade45

Please sign in to comment.