From 5bd39542a3ebceb9630526db0f543c2993d8fd09 Mon Sep 17 00:00:00 2001 From: AV77web Date: Tue, 9 Jun 2026 11:31:25 +0200 Subject: [PATCH] modifica a deploy.yml --- .github/workflows/deploy.yml | 38 ++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e9bdafb..4b452ee 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,20 +1,46 @@ +name: Deploy to VPS + on: push: - branches: [main] + branches: + - main workflow_dispatch: jobs: - deploy: + build: runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: https://github.com/actions/checkout@v4 + + - name: Setup Node.js + uses: https://github.com/actions/setup-node@v4 + with: + node-version: "20" + + - name: Install dependencies + run: npm ci --prefer-offline + + - name: Build + run: npm run build + + deploy: + needs: build + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: https://github.com/actions/checkout@v4 + - name: Deploy via SSH - uses: appleboy/ssh-action@v1.0.3 + uses: https://github.com/appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.VPS_HOST }} username: ${{ secrets.VPS_USER }} key: ${{ secrets.VPS_SSH_KEY }} script: | - cd /root/provapratica/backend - git pull origin main + echo "START DEPLOY" + cd /root/provapraticabackend + git pull --ff-only docker compose up -d --build \ No newline at end of file