Skip to content

Commit 8fdcc81

Browse files
committed
新增发布脚本
1 parent 87b5ab3 commit 8fdcc81

File tree

3 files changed

+74
-4
lines changed

3 files changed

+74
-4
lines changed

.github/workflows/build.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
13+
build-check:
14+
15+
name: Build check
16+
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
22+
- run: yarn
23+
- run: yarn build
24+
- run: yarn test

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
8+
jobs:
9+
10+
publish:
11+
12+
name: Publish
13+
14+
if: github.repository_owner == 'coajs'
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- uses: actions/setup-node@v1
22+
with:
23+
node-version: 12
24+
registry-url: https://registry.npmjs.org
25+
26+
- name: Build
27+
run: |
28+
yarn
29+
yarn version --no-git-tag-version --new-version ${{ github.event.release.tag_name }}
30+
yarn build
31+
32+
- name: Test
33+
run: |
34+
yarn test
35+
36+
- name: Publish
37+
env:
38+
NODE_AUTH_TOKEN: ${{ secrets.AEX_NPM_TOKEN }}
39+
run: |
40+
cd dist/src
41+
yarn publish
42+
43+
- name: Sync
44+
run: |
45+
sleep 5s
46+
yarn sync

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
"url": "https://github.com/coajs/coa-error.git"
1818
},
1919
"scripts": {
20-
"dev": "tsc -w",
21-
"build": "rm -rf dist && tsc",
22-
"test": "mocha dist/test",
20+
"dev:watch": "tsc -w",
2321
"test:watch": "mocha dist/test --watch",
24-
"npm-publish": "yarn build && yarn version --patch && cp package.json *.md dist/src && cd dist/src && npm publish"
22+
"build": "rm -rf dist* && tsc && cp package.json *.md dist/src",
23+
"test": "mocha dist/test",
24+
"publish-prerelease": "yarn build && cd dist/src && yarn version --prerelease && yarn publish"
2525
},
2626
"dependencies": {},
2727
"devDependencies": {

0 commit comments

Comments
 (0)