Skip to content

Release & Deploy

Release & Deploy #355

Workflow file for this run

name: Release & Deploy
on:
workflow_run:
workflows: [test]
branches: [master]
types: [completed]
jobs:
Release:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
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 }}