From ba32d9d4828a04606f353366e1e03c9784ae56f8 Mon Sep 17 00:00:00 2001 From: thenatespack Date: Mon, 24 Nov 2025 16:49:51 -0700 Subject: [PATCH] Create deploy.yaml --- .gitea/workflows/deploy.yaml | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .gitea/workflows/deploy.yaml diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..4a51b0e --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,40 @@ +name: Deploy Express API + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: linux_amd64 + + steps: + # Checkout code + - uses: actions/checkout@v3 + + # Pull latest code + - name: Pull latest code + run: | + cd /var/www/myapp/Project + git reset --hard + git pull origin main + + # Install dependencies + - name: Install dependencies + run: | + cd /var/www/myapp/Project + npm install + + # Kill existing process (optional) + - name: Stop previous instance + run: | + pkill -f "node .*app.js" || true + pkill -f "node .*start.js" || true + + # Start app in background + - name: Start app + run: | + cd /var/www/myapp/Project + nohup npm start > app.log 2>&1 & +