From 7b44180de547796cf9790fa1ea2810eda0b6a158 Mon Sep 17 00:00:00 2001 From: Rafael Lopes Date: Thu, 7 May 2026 14:56:58 -0300 Subject: [PATCH] =?UTF-8?q?FIX:=20executa=20deploy=20de=20produ=C3=A7?= =?UTF-8?q?=C3=A3o=20com=20usu=C3=A1rio=20desenvolvimento?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/deploy-prod.yaml | 34 ++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/deploy-prod.yaml b/.gitea/workflows/deploy-prod.yaml index e3cddc1..9de04a8 100644 --- a/.gitea/workflows/deploy-prod.yaml +++ b/.gitea/workflows/deploy-prod.yaml @@ -14,27 +14,37 @@ jobs: steps: - name: Garantindo Safe Directory - run: git config --global --add safe.directory /opt/HUBXGLPI + run: sudo -H -u desenvolvimento git config --global --add safe.directory /opt/HUBXGLPI - name: Deploy da aplicação run: | set -euo pipefail - cd /opt/HUBXGLPI + sudo chown -R desenvolvimento:desenvolvimento /opt/HUBXGLPI - git fetch origin master - git checkout master - git pull --ff-only origin master + sudo -H -u desenvolvimento bash -lc ' + set -euo pipefail - npm ci --omit=dev + cd /opt/HUBXGLPI - pm2 reload ecosystem.config.js --env production || pm2 start ecosystem.config.js --env production - pm2 save + git fetch origin master + git checkout master + git pull --ff-only origin master + + npm ci --omit=dev + + ./node_modules/.bin/pm2 reload ecosystem.config.js --env production || ./node_modules/.bin/pm2 start ecosystem.config.js --env production + ./node_modules/.bin/pm2 save + ' - name: Exibir logs da aplicação if: success() run: | sleep 3 - echo "=== API ===" - pm2 logs hubxglpi-api --lines 15 --nostream - echo "=== CRON ===" - pm2 logs hubxglpi-cron --lines 10 --nostream \ No newline at end of file + sudo -H -u desenvolvimento bash -lc ' + cd /opt/HUBXGLPI + + echo "=== API ===" + ./node_modules/.bin/pm2 logs hubxglpi-api --lines 15 --nostream + echo "=== CRON ===" + ./node_modules/.bin/pm2 logs hubxglpi-cron --lines 10 --nostream + '