-
Notifications
You must be signed in to change notification settings - Fork 2
61 lines (50 loc) · 1.58 KB
/
build.yml
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'microsoft'
java-version: '11' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org/'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Test
run: npm test
- name: Calculate Version Parameters
id: version
run: |
build=${{github.run_number}}
template=`cat ./VERSION`
shortsha=$(git rev-parse --short ${{ github.sha }})
echo "shortsha=$shortsha" >> $GITHUB_OUTPUT
echo "npmver=${template//build/$build}" >> $GITHUB_OUTPUT
- name: ECHO
run: echo "event name is:" ${{ github.event_name }}
- name: Release to NPM
if: github.event_name == 'push'
run: |
npm version ${{ steps.version.outputs.npmver }} --no-git-tag-version
npm pkg set sha=${{ steps.version.outputs.shortsha }}
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_TOKEN }}