57 lines (54 loc) 路 1.7 KB
/
test-and-publish.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
name: react-query tests
on:
push:
branches:
- 'master'
- 'next'
- 'alpha'
- 'beta'
- '1.x'
- '2.x'
pull_request:
jobs:
test:
name: 'Node ${{ matrix.node }}, React ${{ matrix.react }}'
runs-on: ubuntu-latest
strategy:
matrix:
node: [12, 14, 16]
react: [17, 18]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
uses: bahmutov/npm-install@v1
- run: yarn test:ci
env:
REACTJS_VERSION: ${{ matrix.react }}
- run: yarn test:size
if: matrix.node == '16' && matrix.react == '18'
env:
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
publish-module:
name: 'Publish Module to NPM'
needs: test
# publish only when merged in master on original repo, not on PR
if: github.repository == 'tannerlinsley/react-query' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/next' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/1.x' || github.ref == 'refs/heads/2.x')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- name: Install dependencies
uses: bahmutov/npm-install@v1
- run: yarn build
- run: npx semantic-release@17
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
GH_TOKEN: ${{secrets.GH_TOKEN}}