-
-
Notifications
You must be signed in to change notification settings - Fork 51
100 lines (81 loc) · 2.5 KB
/
ci.yml
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
96
97
98
99
100
name: CI
on:
pull_request:
push:
branches:
- main
jobs:
build-test:
name: Build and test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
node-version:
- 18
- 20
- 22
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v4
with:
key: ${{ matrix.os }}-modules-${{ hashFiles('**/package-lock.json') }}
path: '**/node_modules'
restore-keys: |
${{ matrix.os }}-modules-
- name: Install
run: npm install --prefer-offline
- name: Build
run: |
npm run build
- name: Lint
run: npm run lint
- name: Test
run: npm run test
# - name: Generate code coverage
# if: success() && github.ref == 'refs/heads/main' && ${{ matrix.os }} == 'ubuntu-latest' && 16 == ${{ matrix.node-version }}
# uses: paambaati/[email protected]
# env:
# CC_TEST_REPORTER_ID: b4ef7769e0f8f04456e8e1168b4beb44561bd5ce9ca216458a164e19c4cf7308
# with:
# coverageCommand: npm run coverage
# debug: true
release:
name: Release
needs: build-test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node
uses: actions/setup-node@v4
with:
node-version-file: .tool-versions
- name: Install dependencies
run: npm clean-install
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures
- name: Build
run: |
npm run build
rm -rf bin
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm run semantic-release