-
Notifications
You must be signed in to change notification settings - Fork 4
43 lines (36 loc) · 1.3 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
name: Repo --> Staging
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies to be able to build
run: npm ci
#
# this is required because the hosting doesn't allow ESM NodeJS so i need to convert it to CJS...
#
- name: Build
run: npm run build
- name: Upload folder server-to-upload to FTP
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
password: ${{ secrets.PASS }}
server-dir: /wxr-server-staging/
local-dir: ./server-to-upload/
- name: SSH run install and restart
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
password: ${{ secrets.PASS }}
port: ${{ secrets.SSH_PORT }}
script: |
source /home/${{ secrets.USER }}/nodevenv/wxr-server-staging/14/bin/activate
cd /home/${{ secrets.USER }}/wxr-server-staging
npm install
nohup kill $(ps aux | grep "wxr-server-staging" | awk '{print $2}') 2> /dev/null || echo "It was not running... anyway..." &