diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index abdbae4..501927a 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -7,30 +7,33 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Blue-Green + - name: Blue-Green Deploy uses: appleboy/ssh-action@master with: host: 10.1.1.124 username: juru key: ${{ secrets.SSH_PRIVATE_KEY }} script: | + set -e # Interrompe o script se qualquer comando der erro + RELEASE_NAME=release-$(date +%Y%m%d%H%M%S) RELEASE_PATH=/home/juru/apps/releases/$RELEASE_NAME git clone http://10.1.1.124:3000/joelson/Portal-dias-rota.git $RELEASE_PATH - cd $RELEASE_PATH - cp /home/juru/apps/.env .env npm install npm run build - + cp -r public .next/standalone/ cp -r .next/static .next/standalone/.next/ + cp .env .next/standalone/.env ln -sfn $RELEASE_PATH /home/juru/apps/current pm2 reload portal-dias-rota || pm2 start /home/juru/apps/current/ecosystem.config.js + pm2 save + ls -dt /home/juru/apps/releases/* | tail -n +5 | xargs rm -rf \ No newline at end of file