nodejs.yml (1314B)
1 # 118b8825-e6de-4c10-8ec2-e3d5614c1e1f 2 # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node 3 # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 4 5 name: Node.js CI 6 7 on: push 8 9 jobs: 10 build: 11 12 runs-on: ubuntu-latest 13 14 strategy: 15 matrix: 16 node-version: [12.x, 14.x] 17 18 steps: 19 - uses: actions/checkout@v2 20 - name: Use Node.js ${{ matrix.node-version }} 21 uses: actions/setup-node@v1 22 with: 23 node-version: ${{ matrix.node-version }} 24 - run: npm install 25 - run: npm run build --if-present 26 - run: npm test 27 env: 28 CI: true 29 30 publish: 31 needs: build 32 runs-on: ubuntu-latest 33 if: github.ref == 'refs/heads/master' 34 steps: 35 - uses: actions/checkout@v2 36 - uses: actions/setup-node@v1 37 with: 38 node-version: 14 39 registry-url: https://registry.npmjs.org/ 40 - run: rm -rf node_modules 41 - run: npm ci 42 - run: npm run build --if-present 43 - run: if [ $(npm view $(node -p "require('./package.json').name") version) != $(node -p "require('./package.json').version") ]; then npm publish ; fi 44 env: 45 NODE_AUTH_TOKEN: ${{secrets.npm_token}}