diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8685da5 --- /dev/null +++ b/.github/workflows/build.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2fa3836 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/package.json b/package.json index e7d1923..71337bd 100644 --- a/package.json +++ b/package.json @@ -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": {