Skip to content

Commit

Permalink
新增发布脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
adaex committed May 3, 2021
1 parent 87b5ab3 commit 8fdcc81
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 4 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'

jobs:

build-check:

name: Build check

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- run: yarn
- run: yarn build
- run: yarn test
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Release

on:
release:
types:
- created

jobs:

publish:

name: Publish

if: github.repository_owner == 'coajs'

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org

- name: Build
run: |
yarn
yarn version --no-git-tag-version --new-version ${{ github.event.release.tag_name }}
yarn build
- name: Test
run: |
yarn test
- name: Publish
env:
NODE_AUTH_TOKEN: ${{ secrets.AEX_NPM_TOKEN }}
run: |
cd dist/src
yarn publish
- name: Sync
run: |
sleep 5s
yarn sync
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"url": "https://github.com/coajs/coa-error.git"
},
"scripts": {
"dev": "tsc -w",
"build": "rm -rf dist && tsc",
"test": "mocha dist/test",
"dev:watch": "tsc -w",
"test:watch": "mocha dist/test --watch",
"npm-publish": "yarn build && yarn version --patch && cp package.json *.md dist/src && cd dist/src && npm publish"
"build": "rm -rf dist* && tsc && cp package.json *.md dist/src",
"test": "mocha dist/test",
"publish-prerelease": "yarn build && cd dist/src && yarn version --prerelease && yarn publish"
},
"dependencies": {},
"devDependencies": {
Expand Down

0 comments on commit 8fdcc81

Please sign in to comment.