ci: fix pipeline — vps-runner host mode, remove setup-node, add smoke test
All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 23s
All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 23s
This commit is contained in:
@@ -10,17 +10,10 @@ jobs:
|
|||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
name: Build & Deploy
|
name: Build & Deploy
|
||||||
runs-on: vps-runner
|
runs-on: vps-runner
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 22
|
|
||||||
cache: npm
|
|
||||||
cache-dependency-path: |
|
|
||||||
backend/package-lock.json
|
|
||||||
frontend/package-lock.json
|
|
||||||
|
|
||||||
# ── Backend ──────────────────────────────────────────────────────────────
|
# ── Backend ──────────────────────────────────────────────────────────────
|
||||||
- name: Install & build backend
|
- name: Install & build backend
|
||||||
working-directory: backend
|
working-directory: backend
|
||||||
@@ -29,6 +22,7 @@ jobs:
|
|||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
- name: Deploy backend
|
- name: Deploy backend
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /var/www/originsdigital/backend
|
mkdir -p /var/www/originsdigital/backend
|
||||||
rsync -a --delete backend/dist/ /var/www/originsdigital/backend/dist/
|
rsync -a --delete backend/dist/ /var/www/originsdigital/backend/dist/
|
||||||
@@ -37,7 +31,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Restart pm2
|
- name: Restart pm2
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
run: pm2 restart originsdigital-backend || pm2 start /var/www/originsdigital/backend/dist/index.js --name originsdigital-backend
|
run: |
|
||||||
|
pm2 restart originsdigital-backend || pm2 start /var/www/originsdigital/backend/dist/index.js --name originsdigital-backend
|
||||||
|
pm2 save
|
||||||
|
|
||||||
# ── Frontend ─────────────────────────────────────────────────────────────
|
# ── Frontend ─────────────────────────────────────────────────────────────
|
||||||
- name: Install & build frontend
|
- name: Install & build frontend
|
||||||
@@ -54,3 +50,11 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir -p /var/www/originsdigital/frontend/dist
|
mkdir -p /var/www/originsdigital/frontend/dist
|
||||||
rsync -a --delete frontend/dist/ /var/www/originsdigital/frontend/dist/
|
rsync -a --delete frontend/dist/ /var/www/originsdigital/frontend/dist/
|
||||||
|
|
||||||
|
# ── Smoke test ───────────────────────────────────────────────────────────
|
||||||
|
- name: Smoke test API
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
|
run: |
|
||||||
|
sleep 3
|
||||||
|
curl -sf http://localhost:4001/api/health | grep -q '"ok"'
|
||||||
|
echo "✅ API health OK"
|
||||||
|
|||||||
Reference in New Issue
Block a user