-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (62 loc) · 1.77 KB
/
manual.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Build and Deploy
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install UI Dependencies
run: |
cd ui
npm install
- name: Build UI
run: |
cd ui
npm run build
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install Backend Dependencies
run: |
cd backend
pip install -r requirements.txt
- name: Save Build Artifacts
uses: actions/upload-artifact@v2
with:
name: build-artifacts
path: |
ui/build
backend
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: build-artifacts
- name: Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Stop Running Backend
run: |
ssh ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }} 'sudo systemctl stop sdcompare'
- name: Deploy UI to Server
run: |
rsync -avz -e "ssh -o StrictHostKeyChecking=no" ui/build/ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:/home/sdcompare/sdcompare/ui/
- name: Deploy Backend to Server
run: |
rsync -avz -e "ssh -o StrictHostKeyChecking=no" backend/ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:/home/sdcompare/sdcompare/backend/
- name: Start Backend
run: |
ssh ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }} 'sudo systemctl start sdcompare'