Skip to content

Confirm password

Confirm password #38

Workflow file for this run

name: Manong API CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Generate Prisma Client
run: npx prisma generate --schema=prisma/schema.prisma
- name: Run Lint
run: npm run lint
- name: Run Tests
run: npm test
- name: Build App
run: npm run build
- name: Deploy to VPS
uses: appleboy/ssh-action@v0.1.10
with:
host: ${{ secrets.VPS_HOST }}
username: root
key: ${{ secrets.VPS_PRIVATE_KEY }}
port: 22
script: |
# Ensure folder is clean and clone if necessary
if [ ! -d "/root/manong-api/.git" ]; then
rm -rf /root/manong-api
git clone https://github.com/manongapplication/manong-api.git /root/manong-api
fi
cd /root/manong-api
git reset --hard
git pull origin main
# Install dependencies
if [ ! -f "package-lock.json" ]; then
npm install
else
npm ci
fi
# Generate Prisma Client
npx prisma generate --schema=prisma/schema.prisma
# Build
npm run build
# Start or restart app
pm2 start dist/main.js --name manong-api --update-env || pm2 restart manong-api --update-env