-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (42 loc) · 1.2 KB
/
node.js.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
name: Node.js CI
on:
workflow_dispatch:
push:
branches:
- main
- dev
pull_request:
branches: [ "main", "dev" ]
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm i
- run: npm install -g @c8y/cli
- run: npm run build --if-present
- run: copy cumulocity.json dist
- name: Copy build folder contents to the dist folder
run: |
mv dist/login-app/* dist/
rm -r dist/login-app
- run: npm test
- name: Validate the branch and deploy
run: |
if [ ${{ github.ref }} == 'refs/heads/main' ]; then
echo "Branch Name ******* ${{ github.ref }}"
echo "Deploy to Main"
c8ycli deploy -u ${{ secrets.C8Y_MAIN_URL }} -U ${{ secrets.C8Y_MAIN_USERNAME }} -P ${{ secrets.C8Y_MAIN_PWD }} dist
else
echo "Deploy to Master"
c8ycli deploy -u ${{ secrets.C8Y_DEV_URL }} -U C8Y_DEV_USERNAME -P C8Y_DEV_PWD dist
fi
shell: bash