Skip to content

Commit 1264006

Browse files
committed
feat: add auto shipit
1 parent 954c5ec commit 1264006

File tree

4 files changed

+801
-18
lines changed

4 files changed

+801
-18
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,16 @@ jobs:
1919
with:
2020
node-version: ${{ matrix.node }}
2121

22-
- name: Install deps and build (with cache)
23-
uses: bahmutov/npm-install@v1
22+
- name: Cache node modules
23+
uses: actions/cache@v1
24+
with:
25+
path: node_modules
26+
key: yarn-deps-${{ hashFiles('yarn.lock') }}
27+
restore-keys: |
28+
yarn-deps-${{ hashFiles('yarn.lock') }}
29+
30+
- name: Install
31+
run: yarn --frozen-lockfile
2432

2533
- name: Format
2634
run: yarn format:check

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Release
2+
on: [push]
3+
jobs:
4+
release:
5+
runs-on: ubuntu-latest
6+
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
7+
steps:
8+
- uses: actions/checkout@v2
9+
10+
- name: Prepare repository
11+
run: git fetch --unshallow --tags
12+
13+
- name: Use Node.js 12.x
14+
uses: actions/setup-node@v1
15+
with:
16+
node-version: 12.x
17+
18+
- name: Cache node modules
19+
uses: actions/cache@v1
20+
with:
21+
path: node_modules
22+
key: yarn-deps-${{ hashFiles('yarn.lock') }}
23+
restore-keys: |
24+
yarn-deps-${{ hashFiles('yarn.lock') }}
25+
26+
- name: Install
27+
run: yarn --frozen-lockfile
28+
29+
- name: Build
30+
run: yarn build
31+
32+
- name: Release
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36+
run: yarn run auto shipit

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
"scripts": {
1212
"format:all": "prettier '**/*.{js,jsx,ts,tsx,json,css}' --write",
1313
"format:check": "prettier '**/*.{js,jsx,ts,tsx,json,css}' --check",
14-
"build": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme && rm -f oclif.manifest.json",
14+
"build": "rm -rf lib && tsc -b",
1515
"test": "jest",
16-
"prepare": "yarn build && yarn test"
16+
"update:readme": "oclif-dev manifest && oclif-dev readme && rm -f oclif.manifest.json && git add README.md",
17+
"prepublishOnly": "yarn build && yarn test && yarn update:readme"
1718
},
1819
"husky": {
1920
"hooks": {
20-
"pre-commit": "oclif-dev readme && git add README.md",
21+
"pre-commit": "yarn update:readme",
2122
"commit-msg": "./bin/run commit $HUSKY_GIT_PARAMS"
2223
}
2324
},
@@ -38,6 +39,7 @@
3839
"@types/jest": "26.0.15",
3940
"@types/lodash": "4.14.165",
4041
"@types/node": "10.17.48",
42+
"auto": "10.4.2",
4143
"globby": "11.0.1",
4244
"husky": "4.3.0",
4345
"jest": "26.6.3",

0 commit comments

Comments
 (0)