Skip to content

Merge pull request #106 from Medical-Information-Portal-Stethoscope/f… #175

Merge pull request #106 from Medical-Information-Portal-Stethoscope/f…

Merge pull request #106 from Medical-Information-Portal-Stethoscope/f… #175

Workflow file for this run

name: Stethoscope frontend push
on: [push]
jobs:
dispatch:
if: github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
steps:
- name: Push to repo
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.PAT }}
repository: "Medical-Information-Portal-Stethoscope/medical-information-portal"
event-type: update_remote
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "module": "frontend", "branch": "develop"}'
build_and_push_to_docker_hub:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker
uses: docker/login-action@v2
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to Docker Hub
uses: docker/build-push-action@v4
with:
context: ./
push: true
tags: ${{ vars.DOCKER_USERNAME }}/stethoscope-frontend:latest
deploy:
runs-on: ubuntu-latest
needs: build_and_push_to_docker_hub
steps:
- name: executing remote ssh commands to deploy
uses: appleboy/ssh-action@master
with:
host: ${{ vars.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
script: |
cd /opt/stethoscope_infra
sudo docker compose down
sudo docker image rm ${{ vars.DOCKER_USERNAME }}/stethoscope-frontend
sudo docker compose pull
sudo docker compose up -d