Skip to content

maybe this config will work #4

maybe this config will work

maybe this config will work #4

Workflow file for this run

name: Deploy to DigitalOcean
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Deploy to DigitalOcean
env:
HOST: ${{ secrets.HOST }}
USERNAME: ${{ secrets.USERNAME }}
PASSWORD: ${{ secrets.PASSWORD }}
ENV_FILE_CONTENT: ${{ secrets.ENV_FILE_CONTENT }}
run: |
sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no $USERNAME@$HOST '
mkdir -p hackgpt
cd hackgpt
if [ ! -d .git ]; then
git init
git remote add origin https://github.com/${{ github.repository }}.git
git config core.sparseCheckout true
echo "Dockerfile" >> .git/info/sparse-checkout
echo "api/" >> .git/info/sparse-checkout
echo "requirements.txt" >> .git/info/sparse-checkout
git pull --depth=1 origin main
else
git pull origin main
fi
echo "$ENV_FILE_CONTENT" > .env
docker build -t hackgpt .
docker stop hackgpt-container || true
docker rm hackgpt-container || true
docker run -d --name hackgpt-container -p 8000:8000 hackgpt
'