-
Notifications
You must be signed in to change notification settings - Fork 1
73 lines (64 loc) · 1.81 KB
/
build.yml
File metadata and controls
73 lines (64 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Build Browser Extension
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
workflow_call:
inputs:
browser:
description: Browser platform to build for (e.g., "chrome", '["firefox", "chrome"]')
required: false
default: '["chrome", "firefox"]'
type: string
jobs:
test:
strategy:
matrix:
node-version: [18, 20]
uses: ./.github/workflows/test.yml
with:
node-version: ${{ matrix.node-version }}
build:
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
browser: ${{ fromJSON(github.event.inputs.browser || '["chrome", "firefox"]') }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node v20
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Install dependencies
run: npm ci
- name: Build extension for ${{ matrix.browser }}
run: npm run build:${{ matrix.browser }}
- name: Validate build result
if: ${{ matrix.browser == 'firefox' }}
run: |
npm install -g web-ext
# lint the extension before signing
web-ext lint \
--source-dir="./dist" \
--output=json \
--pretty \
--warnings-as-errors
LINT_EXIT_CODE=$?
if [ $LINT_EXIT_CODE -ne 0 ]; then
echo "::error::Linting failed with exit code $LINT_EXIT_CODE. Build validation for Firefox failed."
exit 1
fi
- name: Upload extension zip
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.browser }}-extension
path: dist/*
if-no-files-found: error