Create deploy.yaml
This commit is contained in:
40
.gitea/workflows/deploy.yaml
Normal file
40
.gitea/workflows/deploy.yaml
Normal file
@@ -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 &
|
||||||
|
|
||||||
Reference in New Issue
Block a user