Skip to content

Release & Deploy

Release & Deploy #688

Workflow file for this run

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-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Load zen cli
run: curl -L https://github.com/HealthSamurai/ftr/releases/latest/download/zen.jar -o ./zen.jar
- name: Install zen deps
run: cd zenproject && java -jar ../zen.jar zen pull-deps
- name: Build zen project
run: java -jar zen.jar 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: 18
- name: Prepare config
run: cp contrib/emr-config/config.production.js contrib/emr-config/config.js
- name: Prepare index.html
run: cp public/index.production.html index.html
- name: Install deps
run: yarn install
- 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