<NME> build-and-release.yml
<BEF> ADDFILE
<MSG> refactor auto release to release only if all jobs were successful on master (#210)

* refactor auto release to release only if all jobs were successful on master

* set NODE_AUTH_TOKEN to fix npm authentication

Co-authored-by: Flavien Cathala <156411c715c14fb4d98cc7e9f19528d5ee055b3b@liquidshare.io>
<DFF> @@ -0,0 +1,46 @@
+name: Build and release
+
+on:
+  push:
+  pull_request:
+    branches: [master]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        node-version: [10.x, 12.x, 14.x]
+
+    steps:
+      - uses: actions/checkout@v2
+      - name: Use Node.js ${{ matrix.node-version }}
+        uses: actions/setup-node@v2
+        with:
+          node-version: ${{ matrix.node-version }}
+          registry-url: https://registry.npmjs.org/
+      - run: npm ci
+      - run: npm run test:ci
+        env:
+          CI: true
+
+  release:
+    name: Release
+    if: ${{ github.ref == 'refs/heads/master' }}
+    runs-on: ubuntu-latest
+    needs: [build]
+    steps:
+      - uses: actions/checkout@v2
+      - name: Use Node.js ${{ matrix.node-version }}
+        uses: actions/setup-node@v2
+        with:
+          node-version: 14
+          registry-url: https://registry.npmjs.org/
+      - run: npm ci
+      - name: Release
+        run: npx semantic-release --debug
+        env:
+          CI: true
+          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
+          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
+          GH_TOKEN: ${{ secrets.GH_TOKEN }}

refactor auto release to release only if all jobs were successful on master (#210)