37 lines
977 B
YAML
37 lines
977 B
YAML
name: Deploy Next.js via SSH (Direto)
|
|
on: [push]
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Update and Restart Server
|
|
uses: appleboy/ssh-action@master
|
|
with:
|
|
host: 10.1.1.124
|
|
username: juru
|
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
script: |
|
|
APP_PATH=/home/juru/apps/portal-dias-rota
|
|
|
|
if [ ! -d "$APP_PATH" ]; then
|
|
git clone http://10.1.1.124:3000/joelson/Portal-dias-rota.git $APP_PATH
|
|
fi
|
|
|
|
cd $APP_PATH
|
|
|
|
git pull origin main
|
|
|
|
npm install
|
|
npm run build
|
|
|
|
if [ -d ".next/standalone" ]; then
|
|
cp -r public .next/standalone/
|
|
cp -r .next/static .next/standalone/.next/
|
|
fi
|
|
|
|
pm2 reload portal-dias-rota || pm2 start npm --name "portal-dias-rota" -- start
|
|
|
|
pm2 save |