-
Notifications
You must be signed in to change notification settings - Fork 5
44 lines (38 loc) · 1.47 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
# The following script assumes the following:
#
# Depencencies installed on the destination machine: npm, node, pm2, tsc
# * `~/hampalyzer` is this cloned repo in the user's home directory
# * `pm2 start dist/index.js --name hampalyzer` was previously run
name: Deploy Hampalyzer
# Controls when the action will run.
on:
push:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
deploy:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: deploy script
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_NAME }}
username: ${{ secrets.DEPLOY_USER }}
password: ${{ secrets.DEPLOY_PASSWORD }}
script: |
export NVM_DIR=~/.nvm
export HAMPALYZER_DB_USER=${{ secrets.DEPLOY_USER }}
export HAMPALYZER_DB_PASSWORD=${{ secrets.DEPLOY_DB_PASSWORD }}
source ~/.nvm/nvm.sh
cd ~/hampalyzer
git reset --hard origin/master
git pull origin master
npm install
tsc
cp -rfL ~/hampalyzer/frontend/* -t /var/www/app.hampalyzer.com/html
cp -rf ~/hampalyzer/parsedlogs/assets/ -t /var/www/app.hampalyzer.com/html/
cd ~/hampalyzer/dist
pm2 restart hampalyzer --update-env -- server parsedlogs /var/www/app.hampalyzer.com/html --reparse