-
Notifications
You must be signed in to change notification settings - Fork 30
103 lines (102 loc) · 3.81 KB
/
main.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
name: Release & Deploy
on:
workflow_run:
workflows: [test]
branches: [master]
types: [completed]
jobs:
ZenProject:
permissions:
contents: write
packages: write
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
- name: Install zen-cli
run: npm install -g @aidbox/zen-cli
- name: Install zen deps
run: zen-cli pull-deps
- name: Build zen project
run: zen-cli zen build zenproject beda-emr
- uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: latest
title: Development build
draft: true
files: |
zenproject/beda-emr.zip
Release:
runs-on: ubuntu-latest
needs: ZenProject
env:
BUILD_IMAGE: bedasoftware/fhir-emr:master
DISABLE_ESLINT_PLUGIN: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Prepare config
run: cp shared/src/config.production.ts shared/src/config.ts
- name: Prepare index.html
run: cp public/index.production.html index.html
- name: Install deps
run: yarn install --network-concurrency 1
- run: yarn extract
- run: yarn compile
- run: yarn build
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- run: docker run --rm --privileged tonistiigi/binfmt --install all
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- run: >-
docker buildx build --platform linux/arm64,linux/amd64
-f Dockerfile.web.release
--push -t ${{ env.BUILD_IMAGE }} .
Deploy:
if: github.ref == 'refs/heads/master' && ${{ github.event.workflow_run.conclusion == 'success' }}
needs: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cleanup seeds
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script_stop: true
script: rm -rf /root/fhir-emr-master/resources/seeds
- name: Deploy to Server
uses: easingthemes/[email protected]
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
ARGS: '-rltgoDzvO'
SOURCE: './'
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: '~/fhir-emr-master'
- name: Restart
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script_stop: true
script: |
cd ~/web
make restart
echo Current branch is ${{ github.ref }}
docker image prune -f