-
Notifications
You must be signed in to change notification settings - Fork 108
72 lines (58 loc) · 1.96 KB
/
node-sdk.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
62
63
64
65
66
67
68
69
70
71
name: Build/Release Node SDK
on:
release:
types: [ published ]
pull_request:
branches: [ main ]
jobs:
build:
name: Build for Node-${{ matrix.node_ver }} ${{ matrix.config.target }}/${{ matrix.config.arch }}
runs-on: ${{ matrix.config.os }}
env:
BUILD_NUMBER: ${{ github.run_number }}
AWS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
strategy:
matrix:
config:
- { os: ubuntu-20.04, target: "linux", arch: "x64" }
node_ver: [ 20 ]
fail-fast: false
steps:
- name: Node Version
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_ver }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
- name: Get current zrok repo tag
id: tag
run: echo "TAG=$(git describe --tags --abbrev=0)" | tee -a $GITHUB_OUTPUT
- name: Update zrok NodeJS-SDK's package.json version based on current zrok repo git tag
if: github.ref_type == 'tag'
run: |
cd ${{ runner.workspace }}/${{ github.event.repository.name }}/sdk/nodejs/sdk
npm version ${{ steps.tag.outputs.TAG }} --no-git-tag-version --allow-same-version
- name: Setup .npmrc
if: github.ref_type == 'tag'
# Setup .npmrc file to prepare for possible publish to npm
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
- name: Build the zrok NodeJS-SDK
run: |
cd ${{ runner.workspace }}/${{ github.event.repository.name }}/sdk/nodejs/sdk
npm install
npm run build
env:
BUILD_DATE: ${{ steps.date.outputs.date }}
- name: NPM Publish
if: github.ref_type == 'tag'
run: |
cd ${{ runner.workspace }}/${{ github.event.repository.name }}/sdk/nodejs/sdk
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}