-
Notifications
You must be signed in to change notification settings - Fork 1
41 lines (37 loc) · 1.3 KB
/
nodejs.yml
File metadata and controls
41 lines (37 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 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 ]
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '18.x'
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm test
- if: github.event_name != 'release'
run: |
NPM_PACKAGE_VERSION=`node -e "const fs = require('fs'); console.log(JSON.parse(fs.readFileSync('package.json')).version);"`
SHORT_SHA=`node -e "const sha = \"$GITHUB_SHA\"; console.log(sha.substring(0, 7));"`
npm run mjs
npm --no-git-tag-version version $NPM_PACKAGE_VERSION-rc.$SHORT_SHA
npm publish --access public --tag dev
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH }}
CI: true
GITHUB_SHA: $${{github.sha}}
- if: github.event_name == 'release'
run: |
npm run mjs
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH }}
CI: true