generated from aldhaneka-LAB/DO-nodejs-autodeploy
-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (31 loc) · 1.07 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
name: Build & Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy Nodejs App
uses: appleboy/[email protected]
with:
host: ${{secrets.SSH_HOST}} # IP address of the server you wish to ssh into
key: ${{secrets.SSH_KEY}} # Private or public key of the server
username: ${{ secrets.SSH_USERNAME }} # User of the server you want to ssh into
script: |
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
cd ~
cd foorum
ls
cd server
ls
git clone https://aldhanekaa:${{secrets.GITHUB_TOKEN}}@github.com/Foorum/nodejs-server.git
pm2 stop foorum-server
rm -rf foorum.aldhaneka.space
mv ~/foorum/server/nodejs-server ~/foorum/server/foorum.aldhaneka.space
cd foorum.aldhaneka.space
npm install
npm run build
pm2 start dist/src/server.js --name foorum-server
sudo service nginx restart