Skip to content

Commit efe73f3

Browse files
committed
feat: setup semantic-release
1 parent 5a338d1 commit efe73f3

File tree

1 file changed

+52
-15
lines changed

1 file changed

+52
-15
lines changed

.github/workflows/main.yml

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,63 @@
11
name: CI
2-
on: [push]
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- beta
7+
- 1.x
8+
pull_request:
9+
paths-ignore:
10+
- '.gitignore'
11+
- '.npmignore'
12+
- '*.md'
13+
314
jobs:
415
build:
16+
name: Lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}
517
runs-on: ubuntu-latest
6-
strategy:
7-
matrix:
8-
node-version: [12.x]
18+
919
steps:
10-
- uses: actions/checkout@v2
11-
- name: Use Node.js ${{ matrix.node-version }}
20+
- name: Checkout repo
21+
uses: actions/checkout@v2
22+
23+
- name: Use Node ${{ matrix.node }}
1224
uses: actions/setup-node@v1
1325
with:
14-
node-version: ${{ matrix.node-version }}
15-
- name: Install dependencies
16-
run: yarn install --frozen-lockfile
26+
node-version: ${{ matrix.node }}
27+
28+
- name: Install deps and build (with cache)
29+
uses: bahmutov/npm-install@v1
30+
1731
- name: Lint
1832
run: |
19-
npm run lint:types
20-
npm run lint
33+
yarn lint
34+
yarn lint:types
35+
2136
- name: Test
22-
run: npm test
23-
env:
24-
CI: true
37+
run: yarn test --ci
38+
2539
- name: Build
26-
run: npm run build
40+
run: yarn build
41+
42+
publish-module:
43+
name: 'Publish Module to NPM on Node ${{ matrix.node }} and ${{ matrix.os }}'
44+
needs: build
45+
if: github.repository == 'react-hook-form/resolvers' && (github.ref =='refs/heads/master' || github.ref == 'refs/heads/1.x')
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Checkout repo
49+
uses: actions/checkout@v2
50+
- name: 'Use Node ${{ matrix.node }}'
51+
uses: actions/setup-node@v1
52+
with:
53+
node-version: '${{ matrix.node }}'
54+
registry-url: 'https://registry.npmjs.org/'
55+
- name: Install dependencies
56+
uses: bahmutov/npm-install@v1
57+
- name: Build
58+
run: yarn build
59+
- name: Publish
60+
run: npx semantic-release
61+
env:
62+
NODE_AUTH_TOKEN: '${{secrets.NPM_TOKEN}}'
63+
GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}'

0 commit comments

Comments
 (0)