Skip to content

Deploying to HIE server #131

Deploying to HIE server

Deploying to HIE server #131

name: Deploying to HIE server
on:
pull_request:
types: [closed]
branches: [main]
release:
types: [published]
workflow_dispatch:
jobs:
build_and_deploy:
name: Build and Deploy
runs-on: ubuntu-latest
strategy:
matrix:
node: [18.x]
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Execute Development Build Script
run: |
chmod +x ./taifa_care_build.sh
echo "n" | ./taifa_care_build.sh
- name: Compress frontend folder
run: tar -czvf frontend-${{ github.sha }}.tar.gz frontend/
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: frontend-${{ github.sha }}.tar.gz
path: frontend-${{ github.sha }}.tar.gz
- name: Upload compressed frontend to server
uses: appleboy/[email protected]
with:
host: ${{ secrets.CICD2_HOST }}
username: ${{ secrets.CICD2_USERNAME }}
port: ${{ secrets.PORT }}
key: ${{ secrets.CICD2_SECRET }}
source: frontend-${{ github.sha }}.tar.gz
target: /apps/githubworkflows/OpenMrs3.0_assets/
- name: Execute remote SSH commands
uses: appleboy/[email protected]
with:
host: ${{ secrets.CICD2_HOST }}
username: ${{ secrets.CICD2_USERNAME }}
key: ${{ secrets.CICD2_SECRET }}
port: ${{ secrets.PORT }}
script: |
cd /apps/githubworkflows/OpenMrs3.0_assets &&
sudo tar -xzf frontend-${{ github.sha }}.tar.gz
sudo bash /apps/workflowConfigs/HEI_WORKfLOW/copy-to-docker.sh
release:
runs-on: ubuntu-latest
needs: build_and_deploy
if: github.event_name == 'release'
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"
cache: "npm"
- name: Run production build script
run: |
chmod +x ./prod-build.sh
./prod-build.sh
- name: Compress frontend folder for release
run: tar -czvf frontend-release-${{ github.sha }}.tar.gz frontend/
- name: Upload release artifacts
uses: actions/upload-artifact@v3
with:
name: frontend-release-${{ github.sha }}.tar.gz
path: frontend-release-${{ github.sha }}.tar.gz