Skip to content

Add a GHA to deploy on merge into staging #1

Add a GHA to deploy on merge into staging

Add a GHA to deploy on merge into staging #1

name: Deploy to staging EC2
on:
pull_request:
branches:
- staging
types: [closed]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup SSH
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.STAGING_EC2_SSH_PRIVATE_KEY }}
- name: SSH and Deploy to EC2
run: |
ssh -o StrictHostKeyChecking=no ec2-user@3.108.64.73 << 'EOF'
docker kill $(docker ps -q)
docker system prune -af
cd /home/ec2-user/danswer
git fetch origin staging
git reset --hard FETCH_HEAD
docker-compose /home/ec2-user/danswer/deployment/docker_compose/docker-compose.prod.yml -d --force-recreate
EOF