Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

ci.yml

61 lines1.8 KB

1name: ci
2​
3on:
4 workflow_dispatch:
5 inputs:
6 tag:
7 description: override release tag
8 required: false
9 push:
10 branches:
11 - 'main'
12 - 'alpha'
13 - 'beta'
14​
15concurrency:
16 group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
17 cancel-in-progress: true
18​
19env:
20 NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
21 NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}
22​
23jobs:
24 test-and-publish:
25 if: github.repository == 'TanStack/query' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta')
26 name: 'Test & Publish'
27 runs-on: ubuntu-latest
28 steps:
29 - uses: actions/checkout@v3
30 with:
31 fetch-depth: '0'
32 - uses: pnpm/action-setup@v2.2.4
33 with:
34 version: 8
35 - uses: actions/setup-node@v3
36 with:
37 node-version: 18.16.0
38 registry-url: https://registry.npmjs.org/
39 cache: 'pnpm'
40 - name: Install dependencies
41 run: pnpm --filter "./packages/**" --filter query --prefer-offline install
42 - name: Run Tests
43 uses: nick-fields/retry@v2.8.3
44 with:
45 command: pnpm run test:ci
46 timeout_minutes: 10
47 max_attempts: 3
48 - name: Publish
49 run: |
50 git config --global user.name 'Tanner Linsley'
51 git config --global user.email 'tannerlinsley@users.noreply.github.com'
52 npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
53 pnpm run cipublish
54 env:
55 GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
56 GH_TOKEN: ${{ secrets.GH_TOKEN }}
57 NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
58 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
59 TAG: ${{ inputs.tag }}
60 - name: Upload coverage to Codecov
61 uses: codecov/codecov-action@v3