forked from dapr/js-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (69 loc) · 2.33 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#
# Copyright 2022 The Dapr Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Build
on:
push:
branches:
- master
- release-*
tags:
- v*
pull_request:
branches:
- master
- release-*
# Manual trigger
workflow_dispatch: {}
jobs:
build:
runs-on: ubuntu-latest
environment: production
env:
NODE_VER: 16.14.0
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- name: Configure .npmrc for NPM publish to @dapr
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VER }}
registry-url: 'https://registry.npmjs.org'
- name: Build Package
run: ./scripts/build.sh
# @TODO: add a depend on the test-e2e pipeline?
- name: Run unit tests
id: tests
run: npm run test:unit:all
- name: Upload test coverage
uses: codecov/codecov-action@v1
- name: Is Release?
if: startswith(github.ref, 'refs/tags/v')
run: echo "DEPLOY_PACKAGE=true" >> $GITHUB_ENV
# note: package.json gets updated here for the new package name
- name: Publish to npm (@dapr/dapr)
if: env.DEPLOY_PACKAGE == 'true'
run: npm publish build/ --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: "[dapr-client] Configure to publish to dapr-client for deprecation notice reasons"
if: env.DEPLOY_PACKAGE == 'true'
run: sed -i s#"@dapr/dapr"#"dapr-client"# package.json
- name: "[dapr-client] Build Package"
if: env.DEPLOY_PACKAGE == 'true'
run: ./scripts/build.sh
# note: package.json gets updated here for the new package name
- name: "[dapr-client] Publish to npm (dapr-client)"
if: env.DEPLOY_PACKAGE == 'true'
run: npm publish build/ --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}