Skip to content

github actions exec to run change #6

github actions exec to run change

github actions exec to run change #6

Workflow file for this run

name: Deploy with Docker on VPS
on:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy to VPS
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
key: ${{ secrets.SSH_KEY }}
port: 22
script: |
if [ -d $HOME/PhriniFluentBackend ]; then
cd ~/PhriniFluentBackend
git pull origin main
else
git clone https://github.com/Flagro/PhriniFluentBackend.git ~/PhriniFluentBackend
cd ~/PhriniFluentBackend
fi
cp .env-example .env
echo "ENVIRONMENT=deployment" >> .env
echo 'SECRET_KEY=${{ secrets.SECRET_KEY }}' >> .env
echo "DB_USER=${{ secrets.DB_USER }}" >> .env
echo 'DB_PASSWORD=${{ secrets.DB_PASSWORD }}' >> .env
echo "ADMIN_USERNAME=${{ secrets.ADMIN_USERNAME }}" >> .env
echo "ADMIN_EMAIL=${{ secrets.ADMIN_EMAIL }}" >> .env
echo 'ADMIN_PASSWORD=${{ secrets.ADMIN_PASSWORD }}' >> .env
sudo ../limited-docker-compose.sh -f docker-compose.prod.yml build
sudo ../limited-docker-compose.sh -f docker-compose.prod.yml up -d
sudo ../limited-docker-compose.sh -f docker-compose.prod.yml run web python manage.py migrate
sudo ../limited-docker-compose.sh -f docker-compose.prod.yml run web python manage.py collectstatic --noinput
sudo ../limited-docker-compose.sh -f docker-compose.prod.yml run web python manage.py createadmin