Commit d8ec632 1 parent 7822ab6 commit d8ec632 Copy full SHA for d8ec632
File tree 1 file changed +50
-0
lines changed
1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Deploy Django API
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+
8
+ jobs :
9
+ deploy :
10
+ runs-on : ubuntu-latest
11
+
12
+ steps :
13
+ # Step 1: Check out the code
14
+ - uses : actions/checkout@v3
15
+
16
+ # Step 2: Set up Python
17
+ - name : Set up Python
18
+ uses : actions/setup-python@v4
19
+ with :
20
+ python-version : 3.10
21
+
22
+ # Step 3: Install dependencies
23
+ - name : Install dependencies
24
+ run : |
25
+ python -m venv .venv
26
+ source .venv/bin/activate
27
+ pip install -r requirements.txt
28
+
29
+ # Step 4: Run migrations and create superuser
30
+ - name : Run migrations and create superuser
31
+ run : |
32
+ source .venv/bin/activate
33
+ python manage.py migrate
34
+ python manage.py createsuperuser --email [email protected] --username username
35
+
36
+ # Step 5: Deploy to remote server
37
+ - name : Deploy to remote server
38
+ uses :
easingthemes/[email protected]
39
+ env :
40
+ SSH_PRIVATE_KEY : ${{ secrets.SSH_PRIVATE_KEY }}
41
+ REMOTE_HOST : ${{ secrets.REMOTE_HOST }}
42
+ REMOTE_USER : ${{ secrets.REMOTE_USER }}
43
+ TARGET : " /home/django/50v-backend-action-test"
44
+ with :
45
+ ARGS : " --delete"
46
+ SCRIPT_AFTER : |
47
+ source ~/.bashrc
48
+ cd /home/django/your-django-app-directory
49
+ source .venv/bin/activate
50
+ python manage.py runserver
You can’t perform that action at this time.
0 commit comments