-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (44 loc) · 1.9 KB
/
deploying.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
name: Deploy Fe
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
- name: Install dependencies
run: npm install
- name: Build Vue.js app
run: npm run build
- name: Setup SSH Agent
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SERVER_SSH_KEY }}
- name: Stop the service
run: ssh -o StrictHostKeyChecking=no -p ${{ secrets.SSH_PORT }} ${{ secrets.USER_NAME }}@${{ secrets.HOST_NAME }} 'sudo systemctl stop keypracticafe'
- name: Update the repository on server
run: |
ssh -o StrictHostKeyChecking=no -p ${{ secrets.SSH_PORT }} ${{ secrets.USER_NAME }}@${{ secrets.HOST_NAME }} '
if [ ! -d /home/keypractica/fe_server/.git ]; then
rm -rf /home/keypractica/fe_server &&
git clone https://github.com/kneoio/kneox.git /home/keypractica/fe_server
else
cd /home/keypractica/fe_server &&
git fetch origin &&
git reset --hard origin/master &&
git clean -fd
fi
'
- name: Run npm install on server
run: ssh -o StrictHostKeyChecking=no -p ${{ secrets.SSH_PORT }} ${{ secrets.USER_NAME }}@${{ secrets.HOST_NAME }} 'cd /home/keypractica/fe_server && npm install'
- name: Build application on server
run: ssh -o StrictHostKeyChecking=no -p ${{ secrets.SSH_PORT }} ${{ secrets.USER_NAME }}@${{ secrets.HOST_NAME }} 'cd /home/keypractica/fe_server && npm run build'
- name: Start the service
run: ssh -o StrictHostKeyChecking=no -p ${{ secrets.SSH_PORT }} ${{ secrets.USER_NAME }}@${{ secrets.HOST_NAME }} 'sudo systemctl start keypracticafe'