-
Notifications
You must be signed in to change notification settings - Fork 4
95 lines (78 loc) · 2.46 KB
/
ci.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: CI Workflows
on:
push:
branches: ["main"]
tags:
- "v*"
pull_request:
jobs:
lint-and-test:
strategy:
matrix:
version: [18, 19, 20, 21]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version }}
cache: yarn
- name: Install JavaScript Dependencies
run: |
yarn install --frozen-lockfile --ignore-engines
- name: Lint
if: success() || failure()
run: |
yarn lint
- name: Type Check
if: success() || failure()
run: |
yarn type-check
- name: Build
if: success() || failure()
run: |
yarn build
# We only run the browser tests for the development version of node because the browser environment
# is independent of the node version, so all that matters is the build we deploy works in the browser.
- name: Conditionally Install Chrome Dependencies
if: (success() || failure()) && matrix.version == 18
run: |
sudo apt-get install -y libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libgbm1 libasound2 libpangocairo-1.0-0 libxss1 libgtk-3-0
- name: Conditionally Remove Browser Tests
if: (success() || failure()) && matrix.version != 18
run: |
rm test/browser.test.ts
- name: Test
if: success() || failure()
run: |
yarn test:fast
deploy:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [lint-and-test]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.19.0
registry-url: "https://registry.npmjs.org"
- name: Extract Version from Tag
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Install JavaScript Dependencies
run: yarn install --frozen-lockfile
- name: Update package.json Version
run: npm version --no-git-tag-version $VERSION
- name: Build With Updated Version
if: success() || failure()
run: |
yarn build
- name: Publish to NPM
run: |
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}