-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (49 loc) · 1.46 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
47
48
49
50
51
52
53
54
name: Deploy
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: self-hosted
strategy:
max-parallel: 4
matrix:
python-version: [3.9]
node-version: [19.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install frontend dependencies
run: npm install
working-directory: ./frontend
- name: Build
run: npm run build
working-directory: ./frontend
- name: Copy files to /var/www
run: cp -r ~/git/productive/_work/ProductiveMaster/ProductiveMaster/frontend/build /var/www/productive.maksymiliangala.com/
- name: Cleanup
run: rm -rf frontend/
- name: Create virtual environment
working-directory: 'backend'
run: |
python3 -m venv venv
- name: Install Dependencies
working-directory: 'backend'
run: |
python3 -m pip install --upgrade pip
source venv/bin/activate
pip install -r requirements.txt
- name: Create .env
working-directory: 'backend'
run: echo "${{ secrets.ENV_PRODUCTION }}" > .env
- name: Apply migrations
working-directory: 'backend'
run: |
source venv/bin/activate
python3 manage.py migrate
- name: Restart app
working-directory: 'backend'
run: sudo systemctl restart productivemaster.service