Skip to content

Commit 2b26c1a

Browse files
authored
chore(actions): add cache to NPM packages on GitHub actions (TanStack#888)
1 parent 75a1d3d commit 2b26c1a

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

.github/workflows/test-and-publish.yml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,46 @@ name: react-query tests
33
on:
44
push:
55
branches:
6-
- 'master'
7-
- 'next'
8-
- '1.x'
6+
- "master"
7+
- "next"
8+
- "1.x"
99
pull_request:
1010

1111
jobs:
1212
test:
13-
name: 'node ${{ matrix.node }} ${{ matrix.os }} '
14-
runs-on: '${{ matrix.os }}'
13+
name: "Node ${{ matrix.node }}"
14+
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
os: [ubuntu-latest]
18-
node: [14, 12, 10]
17+
node: [10, 12, 14]
1918
steps:
19+
- uses: actions/checkout@v2
2020
- uses: actions/setup-node@v1
2121
with:
2222
node-version: ${{ matrix.node }}
23-
- uses: actions/checkout@v2
24-
- run: npm i -g yarn
25-
- run: yarn --frozen-lockfile
23+
- name: Install dependencies
24+
uses: bahmutov/npm-install@v1
2625
- run: yarn test:ci
2726

2827
publish-module:
29-
name: 'Publish Module to NPM'
28+
name: "Publish Module to NPM"
3029
needs: test
31-
if: github.repository_owner == 'tannerlinsley' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/next' || github.ref == 'refs/heads/1.x') #publish only when merged in master on original repo, not on PR
30+
# publish only when merged in master on original repo, not on PR
31+
if: github.repository == 'tannerlinsley/react-query' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/next' || github.ref == 'refs/heads/1.x')
3232
runs-on: ubuntu-latest
3333
steps:
3434
- uses: actions/checkout@v2
3535
- uses: actions/setup-node@v1
3636
with:
3737
node-version: 14
3838
registry-url: https://registry.npmjs.org/
39-
- run: npm i -g yarn
40-
- run: yarn --frozen-lockfile
39+
- name: Install dependencies
40+
uses: bahmutov/npm-install@v1
4141
- run: yarn build
42-
- run: npx semantic-release@17
42+
- name: Semantic Release
43+
uses: cycjimmy/semantic-release-action@v2
44+
with:
45+
semantic_version: 17
4346
env:
44-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
45-
GH_TOKEN: ${{secrets.GH_TOKEN}}
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
NPM_TOKEN: ${{ secrets.npm_token }}

0 commit comments

Comments
 (0)