feat: Add Gitea Actions workflow for SSH deployment and update PM2 application's working directory.
Deploy Next.js via SSH (Direto) / deploy (push) Successful in 14s Details

This commit is contained in:
JuruSysadmin 2026-01-07 16:59:56 -03:00
parent 52bde0b9dd
commit 75d6a52251
2 changed files with 11 additions and 12 deletions

View File

@ -14,24 +14,23 @@ jobs:
username: juru username: juru
key: ${{ secrets.SSH_PRIVATE_KEY }} key: ${{ secrets.SSH_PRIVATE_KEY }}
script: | script: |
APP_PATH=/home/juru/apps/portal-dias-rota APP_PATH=/home/juru/Portal-dias-rota
mkdir -p /home/juru/apps
if [ ! -d "$APP_PATH" ]; then if [ ! -d "$APP_PATH" ]; then
git clone http://10.1.1.124:3000/joelson/Portal-dias-rota.git $APP_PATH git clone http://10.1.1.124:3000/joelson/Portal-dias-rota.git $APP_PATH
fi fi
cd $APP_PATH cd $APP_PATH
git fetch origin main
git pull origin main git reset --hard origin/main
npm install npm install
npm run build npm run build
if [ -d ".next/standalone" ]; then
cp -r public .next/standalone/ cp -r public .next/standalone/ || echo "Aviso: public não encontrada"
cp -r .next/static .next/standalone/.next/ cp -r .next/static .next/standalone/.next/ || echo "Aviso: static não encontrada"
fi
pm2 reload portal-dias-rota || pm2 start npm --name "portal-dias-rota" -- start pm2 reload portal-dias-rota || pm2 start npm --name "portal-dias-rota" -- start
pm2 save

View File

@ -2,7 +2,7 @@ module.exports = {
apps: [{ apps: [{
name: "portal-dias-rota", name: "portal-dias-rota",
script: "server.js", script: "server.js",
cwd: "/home/juru/apps/current/.next/standalone", cwd: "/home/juru/apps/ortal-dias-rota",
env: { env: {
NODE_ENV: "production", NODE_ENV: "production",
PORT: 3003, PORT: 3003,