From 2c7e2848fc1ce391533ee6b73a9b81a8fd2468c3 Mon Sep 17 00:00:00 2001 From: Tony-Rome <62573694+Tony-Rome@users.noreply.github.com> Date: Thu, 1 May 2025 18:15:10 -0400 Subject: [PATCH 1/2] Update main.yml --- .github/workflows/main.yml | 50 ++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d3aba39..f218da6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,15 +1,44 @@ -name: CI +name: Deploy PyDay -on: [push] +on: + push: + branches: + - main jobs: - deploy-prod: - if: github.ref == 'refs/heads/main' - runs-on: [ubuntu-latest] + deploy: + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Push to server - uses: appleboy/ssh-action@v1.0.3 + - name: Checkout codigo + uses: actions/checkout@v4 + + - name: Ruta actual de trabajo + run: | + echo "Ruta actual de app pyday: $(pwd)" + ls -la + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Instalacion dependencies & build + run: | + npm ci + npm run build + + - name: Copia archivos hacia droplet + uses: appleboy/scp-action@v1 + with: + host: ${{ secrets.PYDAY_SERVER }} + username: ${{ secrets.PYDAY_USER }} + password: ${{ secrets.PYDAY_PASS }} + port: ${{ secrets.PYDAY_PORT }} + source: ".next/,public,next.config.js,package.json,package-lock.json" + target: "/home/pyday" + + - name: Iniciar app con PM2 en el servidor + uses: appleboy/ssh-action@v1 with: host: ${{ secrets.PYDAY_SERVER }} username: ${{ secrets.PYDAY_USER }} @@ -17,5 +46,6 @@ jobs: port: ${{ secrets.PYDAY_PORT }} script: | cd /home/pyday - ls -l - sh deploy.sh + npm install --omit=dev + pm2 delete pyday || true + pm2 start npm --name "pyday" -- start From f8760e7cca2a1a336efcfb74401a497877ffd3e5 Mon Sep 17 00:00:00 2001 From: Tony-Rome <62573694+Tony-Rome@users.noreply.github.com> Date: Thu, 1 May 2025 18:23:46 -0400 Subject: [PATCH 2/2] Delete path printing step --- .github/workflows/main.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f218da6..174cece 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,11 +12,6 @@ jobs: - name: Checkout codigo uses: actions/checkout@v4 - - name: Ruta actual de trabajo - run: | - echo "Ruta actual de app pyday: $(pwd)" - ls -la - - name: Setup node uses: actions/setup-node@v4 with: