generated from openmrs/openmrs-esm-template-app
-
Notifications
You must be signed in to change notification settings - Fork 13
114 lines (96 loc) · 3.42 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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Node.js CI
on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]
release:
types:
- created
env:
ESM_NAME: "@icap-ethiopia/esm-ethiohri-app"
JS_NAME: "openmrs-esm-ethiohri-app.js"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "18"
- run: yarn
- run: yarn lint
- run: yarn coverage
- run: yarn typescript
- run: yarn build
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: |
dist
pre_release:
runs-on: ubuntu-latest
needs: build
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop'}}
steps:
- uses: actions/checkout@v2
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "18"
registry-url: "https://registry.npmjs.org"
- run: yarn
- run: sed -i -e "s/\(\"version\":\\s\+\"\([0-9]\+\.\?\)\+\)/\1-pre.${{ github.run_number }}/" 'package.json'
- run: yarn config set npmAuthToken "${ICAP_ACCESS_TOKEN}" && yarn cipublish --access public --tag next --no-git-tag-version
env:
NODE_AUTH_TOKEN: ${{ secrets.ICAP_ACCESS_TOKEN }}
release:
runs-on: ubuntu-latest
needs: build
# if: ${{ github.event_name == 'release'}}
if: ${{ github.event_name == 'pull_request' && github.base_ref == 'master'}}
steps:
- uses: actions/checkout@v2
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "18"
registry-url: 'https://registry.npmjs.org'
- run: yarn
- run: sed -i -e "s/\(\"version\":\\s\+\"\([0-9]\+\.\?\)\+\)/\1-release-pre.${{ github.run_number }}/" 'package.json'
- run: yarn config set npmAuthToken "${ICAP_ACCESS_TOKEN}" && yarn cipublish --access public --tag latest --no-git-tag-version
env:
NODE_AUTH_TOKEN: ${{ secrets.ICAP_ACCESS_TOKEN }}
dev:
runs-on: ethiohri-self-hosted
needs: pre_release
if: ${{ github.ref == 'refs/heads/develop' }}
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Compute Timestamp
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Run the Update MicroFronEnd Script on dev server
run: cd /usr/share/tomcat/frontendmodules/ && /bin/bash update_frontend_modules.sh
demo:
runs-on: ubuntu-latest
needs: release
if: ${{ github.event_name == 'pull_request' && github.base_ref == 'master'}}
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Compute Timestamp
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- uses: garygrossgarten/github-action-ssh@release
name: Run the Update MicroFronEnd Script on Demo server
with:
command: cd /usr/share/tomcat7/frontendmodules/ && /bin/bash update_frontend_modules.sh
host: ${{ secrets.ETHIOHRI_DEMO_HOST }}
username: ${{ secrets.ETHIOHRI_DEMO_USER }}
privateKey: ${{ secrets.ETHIOHRI_DEMO_PRIVATE_KEY}}