Skip to content

CD

CD #10

Workflow file for this run

name: CD
on:
workflow_run:
workflows:
- ContinuousIntegration
types:
- completed
branches:
- main
- development
pull_request:
types:
- closed
branches:
- main
- development
jobs:
deploy:
if: (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push')
|| github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: SSH into EC2 and deploy
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd /home/ec2-user
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/readup-sever
docker compose down
docker compose up -d
docker system prune -f