-
Notifications
You must be signed in to change notification settings - Fork 1
41 lines (37 loc) · 1.58 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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 --build
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