-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (66 loc) · 1.89 KB
/
build.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
name: Build and Deploy to production
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 14.17.6
- run: npm install --production
- run: npm run build-prod
- run: mv dist server/front
- run: cd server && npm install --production && cd ..
- name: Upload artifact
uses: actions/upload-artifact@v1
with:
name: dist
path: server/
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v1
with:
name: dist
- name: Delete old files
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
shopt -s extglob
sudo systemctl stop ${{ secrets.SERVICE_NAME_PROD }}
cd ${{ secrets.DEPLOY_TARGET }}
rm -rf !(build-db.sqlite)
- name: Upload files
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
strip_components: 1
source: "dist"
target: "${{ secrets.DEPLOY_TARGET }}"
restart:
runs-on: ubuntu-latest
needs: deploy
steps:
- name: Restart service
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
sudo systemctl start ${{ secrets.SERVICE_NAME_PROD }}