Skip to content

github actions

github actions #1

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
jobs:
Production:
name: Deploy to DigitalOcean
runs-on: ubuntu-latest
environment: Production
steps:
- uses: actions/checkout@v3
- name: Build & Deploy
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_HOST: ${{secrets.SSH_HOST}}
USER_NAME: ${{secrets.USER_NAME}}
run: |
echo "Deploying to EC2"
echo "${{ secrets.SSH_PRIVATE_KEY }}" > private_key && chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ${{ secrets.USER_NAME }}@${{ secrets.SSH_HOST }} '
cd /root/course-gpt &&
git reset --hard &&
git checkout main &&
git pull origin main &&
docker-compose down &&
docker-compose rm -fsv &&
docker-compose up --build -d
'