83 lines
3.5 KiB
YAML
83 lines
3.5 KiB
YAML
name: Build Web Extension
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
environment:
|
|
type: environment
|
|
default: "Local"
|
|
build:
|
|
type: string
|
|
description: "Build number (int, 3 max digits)"
|
|
default: "0"
|
|
required: true
|
|
|
|
push:
|
|
branches:
|
|
- "main"
|
|
- "feature/**"
|
|
- "fix/**"
|
|
paths:
|
|
- "packages/app/**"
|
|
- "packages/core/**"
|
|
- "packages/extension/**"
|
|
- "packages/locale/**"
|
|
- "assets/**"
|
|
|
|
jobs:
|
|
archive:
|
|
runs-on: ubuntu-latest
|
|
environment: ${{ github.event.inputs.environment || 'Local' }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version-file: ".nvmrc"
|
|
- name: Install dependencies
|
|
run: |
|
|
npm i -g npm@8.2.0 web-ext@6.6.0
|
|
npm ci
|
|
- name: Build
|
|
env:
|
|
RELEASE_BUILD: ${{ github.event.inputs.build || '0' }}
|
|
PL_SERVER_URL: ${{ secrets.PL_SERVER_URL }}
|
|
PL_BUILD_ENV: ${{ secrets.PL_BUILD_ENV }}
|
|
run: npm run web-extension:build
|
|
- name: Sign for Firefox
|
|
if: github.event.inputs.environment == 'Beta' || github.event.inputs.environment == 'Production'
|
|
run: cd packages/extension/dist && web-ext sign --id="${{ secrets.PL_WEB_EXTENSION_FIREFOX_ID }}" --channel=unlisted --api-key=${{ secrets.PL_WEB_EXTENSION_FIREFOX_API_KEY }} --api-secret=${{ secrets.PL_WEB_EXTENSION_FIREFOX_API_SECRET }}
|
|
- name: Archive Signed Web Extension (Firefox)
|
|
if: github.event.inputs.environment == 'Beta' || github.event.inputs.environment == 'Production'
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: padloc-web-extension-${{ github.sha }}-signed.xpi
|
|
path: packages/extension/dist/web-ext-artifacts/*.xpi
|
|
if-no-files-found: error
|
|
- name: Archive Unsigned Web Extension (Chrome/Edge)
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: padloc-web-extension-${{ github.sha }}-unsigned
|
|
path: |
|
|
packages/extension/dist
|
|
!packages/extension/dist/web-ext-artifacts
|
|
!packages/extension/dist/*.xpi
|
|
if-no-files-found: error
|
|
- name: Build ZIP for signing Chrome/Edge Extension
|
|
uses: cardinalby/webext-buildtools-pack-extension-dir-action@v1
|
|
with:
|
|
extensionDir: packages/extension/dist
|
|
zipFilePath: packages/extension/padloc.zip
|
|
zipIgnore: web-ext-artifacts/**|*.xpi
|
|
- name: Sign for Chrome/Edge
|
|
uses: cardinalby/webext-buildtools-chrome-crx-action@v2
|
|
with:
|
|
zipFilePath: packages/extension/padloc.zip
|
|
crxFilePath: packages/extension/padloc-signed.crx
|
|
privateKey: ${{ secrets.PL_WEB_EXTENSION_CHROME_CRX_PRIVATE_KEY }}
|
|
- name: Archive Signed Web Extension (Chrome/Edge)
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: padloc-web-extension-${{ github.sha }}-signed.crx
|
|
path: packages/extension/padloc-signed.crx
|
|
if-no-files-found: error
|