-
-
Notifications
You must be signed in to change notification settings - Fork 34
80 lines (75 loc) · 2.24 KB
/
frontend-build-prepare.yaml
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
74
75
76
77
78
79
80
name: Frontend Prepare Build
on:
pull_request:
paths:
- 'frontend/src/**'
- 'frontend/*.json'
- 'frontend/*.js'
- 'frontend/*.ts'
- '.github/workflows/frontend-build-check.yaml'
jobs:
setup-and-build:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
# Setup:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: frontend/yarn.lock
- name: Restore cache
uses: actions/cache@v4
with:
path: frontend/dist
key: ${{ runner.os }}-btrix-frontend-build-${{ hashFiles('frontend/dist') }}
restore-keys: |
${{ runner.os }}-btrix-frontend-build-
- name: Install dependencies
working-directory: frontend
env:
HUSKY: 0
run: yarn install --frozen-lockfile
# Lint:
- name: Lint
working-directory: frontend
run: yarn lint:check
# Localize:
- name: Extract strings
working-directory: frontend
run: yarn localize:extract
- name: Commit extracted strings
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply `localize:extract` changes
file_pattern: '**/*.xlf'
skip_fetch: true
skip_checkout: true
- name: Check localization build
working-directory: frontend
run: yarn localize:build
# Test:
- name: Unit tests
working-directory: frontend
run: yarn test
# Check build:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host
- name: Build Frontend
uses: docker/build-push-action@v3
with:
context: frontend
load: true
tags: webrecorder/browsertrix-frontend:latest
cache-from: type=gha,scope=frontend
cache-to: type=gha,scope=frontend,mode=max