Skip to content

Commit

Permalink
Setup semantic-release (#101)
Browse files Browse the repository at this point in the history
* chore: remove changesets

* ci: setup semantic-release

* ci: update branch check
  • Loading branch information
jorisre authored Dec 31, 2020
1 parent b97f54c commit 0eb3243
Show file tree
Hide file tree
Showing 6 changed files with 3,122 additions and 644 deletions.
8 changes: 0 additions & 8 deletions .changeset/README.md

This file was deleted.

12 changes: 0 additions & 12 deletions .changeset/config.json

This file was deleted.

63 changes: 44 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,58 @@ on:
branches:
- master
pull_request:
branches:
- master
paths-ignore:
- ".gitignore"
- ".npmignore"
- "*.md"
- '.gitignore'
- '.npmignore'
- '*.md'

jobs:
build:
name: Lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
- name: Checkout repo
uses: actions/checkout@v2

- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn install --frozen-lockfile
node-version: ${{ matrix.node }}

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1

- name: Lint
run: |
npm run lint:types
npm run lint
yarn lint
yarn lint:types
- name: Test
run: npm test
env:
CI: true
run: yarn test --ci

- name: Build
run: npm run build
run: yarn build

publish-module:
name: 'Publish Module to NPM on Node ${{ matrix.node }} and ${{ matrix.os }}'
needs: build
if: github.repository == 'react-hook-form/resolvers' && (github.ref =='refs/heads/master')
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: 'Use Node ${{ matrix.node }}'
uses: actions/setup-node@v1
with:
node-version: '${{ matrix.node }}'
registry-url: 'https://registry.npmjs.org/'
- name: Install dependencies
uses: bahmutov/npm-install@v1
- name: Build
run: yarn build
- name: Publish
run: npx semantic-release
env:
NODE_AUTH_TOKEN: '${{secrets.NPM_TOKEN}}'
GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}'
35 changes: 0 additions & 35 deletions .github/workflows/release.yml

This file was deleted.

21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@
},
"scripts": {
"clean": "rimraf dist",
"prebuild": "npm run clean",
"prebuild": "yarn clean",
"build": "tsc && rollup -c",
"lint": "eslint '**/*.{js,ts}'",
"lint:fix": "npm run lint -- --fix",
"lint:fix": "yarn lint -- --fix",
"lint:types": "tsc --noEmit",
"test": "jest --runInBand",
"test:watch": "npm run test -- --watchAll --coverage",
"postversion": "git push && git push origin v$npm_package_version",
"prepublishOnly": "npm run lint && npm run lint:types && npm test && npm run build",
"release": "yarn build && changeset publish"
"test:watch": "yarn test --watchAll --coverage"
},
"keywords": [
"scheme",
Expand All @@ -58,8 +55,6 @@
},
"homepage": "https://react-hook-form.com",
"devDependencies": {
"@changesets/changelog-github": "^0.2.7",
"@changesets/cli": "^2.12.0",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-node-resolve": "^11.0.1",
"@types/jest": "^26.0.19",
Expand All @@ -82,6 +77,7 @@
"rollup": "^2.35.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.29.0",
"semantic-release": "^17.3.1",
"superstruct": "^0.13.1",
"ts-jest": "^26.4.4",
"typescript": "^4.1.3",
Expand All @@ -92,14 +88,19 @@
"peerDependencies": {
"react-hook-form": ">=6.6.0"
},
"release": {
"branches": [
"master"
]
},
"husky": {
"hooks": {
"pre-commit": "npm run lint:types && lint-staged"
"pre-commit": "yarn lint:types && lint-staged"
}
},
"lint-staged": {
"*.{js,ts}": [
"npm run lint:fix"
"yarn lint:fix"
],
"*.{md,json,yml}": [
"prettier --write"
Expand Down
Loading

0 comments on commit 0eb3243

Please sign in to comment.