-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (44 loc) · 1.6 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
42
43
44
45
46
name: Deploy to specific server
on:
push:
branches:
- main
paths-ignore:
- 'docker/**'
- '**.md'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: actions/checkout@v2
- name: Install backend packages
run: pip install -r requirements/dist.txt
- name: Install frontend packages
run: npm install
- name: Build production assets
run: npm run build-dist
- name: Copy static assets
run: python3 manage.dist.py collectstatic --noinput
- name: Copy files to the server
uses: burnett01/[email protected]
with:
switches: -avzr --delete --include-from=.github/workflows/rsync.include --exclude-from=.github/workflows/rsync.exclude
remote_path: ${{ secrets.DEPLOY_PATH }}
remote_host: ${{ secrets.DEPLOY_HOST }}
remote_port: ${{ secrets.DEPLOY_PORT }}
remote_user: ${{ secrets.DEPLOY_USER }}
remote_key: ${{ secrets.DEPLOY_KEY }}
- name: Clear cache and run migrations
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
port: ${{ secrets.DEPLOY_PORT }}
script: |
${{ secrets.DEPLOY_PATH }}/env/bin/pip install -r ${{ secrets.DEPLOY_PATH }}/requirements/dist.txt
${{ secrets.DEPLOY_PATH }}/env/bin/python ${{ secrets.DEPLOY_PATH }}/manage.dist.py migrate
supervisorctl restart pbtasks