commit 9011341e33b7c88dd13dbf3e20d423060296f934
parent b874f3e68a15aa36d67d9379341fa8078f52395d
Author: finwo <finwo@pm.me>
Date: Wed, 22 Apr 2020 12:17:11 +0200
Update workflow yamls
Diffstat:
2 files changed, 39 insertions(+), 32 deletions(-)
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
@@ -1,33 +1,40 @@
-name: Test and publish
+# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
+# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
+
+name: Node.js CI
on:
push:
- branches:
- - master
+ branches: [ master ]
jobs:
- build:
-
+ unit_test:
runs-on: ubuntu-latest
-
strategy:
matrix:
- node-version: [8.x, 10.x, 12.x]
-
+ node-version: [10.x, 12.x]
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- - name: npm install and npm test
- run: |
- npm install
- npm test
- - name: npm publish
- run: |
- npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
- npm publish || true
+ - run: npm ci
+ - run: npm run build --if-present
+ - run: npm test
env:
CI: true
- NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
+ publish:
+ needs: unit_test
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-node@v1
+ with:
+ node-version: 12
+ registry-url: https://registry.npmjs.org/
+ - run: npm ci
+ - run: npm build
+ - run: if [ $(npm view $(node -p "require('./package.json').name") version) != $(node -p "require('./package.json').version") ]; then npm publish ; fi
+ env:
+ NODE_AUTH_TOKEN: ${{secrets.npm_token}}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
@@ -1,26 +1,26 @@
-name: Test and publish
+# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
+# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
+
+name: Node.js CI
on:
- push:
- branches-ignore:
- - master
+ pull_request:
+ branches: [ master ]
jobs:
- build:
-
+ unit_test:
runs-on: ubuntu-latest
-
strategy:
matrix:
- node-version: [8.x, 10.x, 12.x]
-
+ node-version: [10.x, 12.x]
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- - name: npm install and npm test
- run: |
- npm install
- npm test
+ - run: npm ci
+ - run: npm run build --if-present
+ - run: npm test
+ env:
+ CI: true