-
Notifications
You must be signed in to change notification settings - Fork 2
107 lines (101 loc) · 2.87 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
101
102
103
104
105
106
107
name: ci
on:
push:
branches:
- master
pull_request:
branches:
- '**'
types:
- opened
- synchronize
- reopened
- ready_for_review
jobs:
check:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'npm'
- run: npm ci
- run: npm run lint
test-node:
if: github.event.pull_request.draft == false
needs: check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest] # [windows-latest, ubuntu-latest, macos-latest]
node: [18]
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- run: npm ci
- run: npm run test:node
env:
W3_TOKEN: ${{secrets.W3_TOKEN}}
- uses: codecov/codecov-action@v3
with:
flags: node
# test-chrome:
# if: github.event.pull_request.draft == false
# needs: check
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-latest] # [windows-latest, ubuntu-latest, macos-latest]
# node: [18]
# fail-fast: true
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v3
# with:
# node-version: ${{ matrix.node }}
# cache: 'npm'
# - run: npm ci
# - run: npm run test:chrome
# env:
# W3_TOKEN: ${{secrets.W3_TOKEN}}
# - uses: codecov/codecov-action@v3
# with:
# flags: node
release:
runs-on: ubuntu-latest
# needs: [test-node, test-chrome]
needs: test-node
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.event.pull_request.draft == false
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
# The logic below handles the npm publication:
# these if statements ensure that a publication only occurs when
# a new release is created:
- run: npm publish
if: ${{ steps.release.outputs.release_created }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- run: |
npm version `node -p -e "require('./package.json').version"`-`git rev-parse --short HEAD` --no-git-tag-version
npm publish --tag next
if: ${{ !steps.release.outputs.release_created }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
name: release rc