-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (41 loc) · 1.4 KB
/
self-hosted-prod.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
42
43
44
45
46
47
48
49
name: Django Deployment Workflow
on:
push:
branches:
- main
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Change file owner
run: |
sudo chown -R $(id -u):$(id -g) ../../
- name: Check if folder exists
run: |
echo "Create if dosen't exist /var/www/${{ github.event.repository.name }}"
sudo mkdir -p /var/www/${{ github.event.repository.name }}/static
- name: Checkout code
uses: actions/checkout@v2
with:
path: 'prod/'
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Build Docker Images
run: |
cd prod
cp ../../.env .
docker-compose -f docker-compose.prod.yml build
docker-compose -f docker-compose.prod.yml run backend python manage.py check --deploy
docker-compose -f docker-compose.prod.yml run backend python manage.py migrate
docker-compose -f docker-compose.prod.yml run backend python manage.py createsuperuser --noinput 2> /dev/null || true
docker-compose -f docker-compose.prod.yml run backend python manage.py collectstatic --no-input
- name: Run tests
run: |
cd prod
# docker-compose -f docker-compose.prod.yml run backend python manage.py test
- name: Run Deployment commands
run: |
cd prod
docker-compose -f docker-compose.prod.yml up --build -d