-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (37 loc) · 1.11 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
44
name: Deploy to Server
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Deploy to Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.DEPLOY_KEY }}
script: |
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm use 18
cd /var/www/no-game.xyz/nogame-app
git reset --hard origin/master
git pull origin master
# Decode and set backend .env
cd packages/backend
echo '${{ secrets.BACKEND_ENV_FILE }}' > .env
npm install
npm run build
# Decode and set frontend .env
cd ../frontend
echo '${{ secrets.FRONTEND_ENV_FILE }}' > .env
npm install
npm run build
# Restart PM2 processes
pm2 restart all