This commit is contained in:
@@ -10,40 +10,42 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build API
|
||||
run: |
|
||||
cd api
|
||||
npm ci
|
||||
npx prisma generate
|
||||
npm run build
|
||||
|
||||
- name: Build Web
|
||||
run: |
|
||||
cd web
|
||||
npm ci
|
||||
npm run build
|
||||
|
||||
- name: Deploy API
|
||||
- name: Deploy with Docker Compose
|
||||
run: |
|
||||
pm2 stop skymoney-api || true
|
||||
rm -rf /opt/skymoney/api/dist /opt/skymoney/api/node_modules
|
||||
cp -r api/dist /opt/skymoney/api/
|
||||
cp -r api/node_modules /opt/skymoney/api/
|
||||
cp -r api/prisma /opt/skymoney/api/
|
||||
|
||||
# Run migrations using the VPS .env
|
||||
cd /opt/skymoney/api
|
||||
set -a
|
||||
source .env
|
||||
set +a
|
||||
npx prisma migrate deploy
|
||||
|
||||
pm2 start /opt/skymoney/api/dist/server.js --name skymoney-api
|
||||
# Deploy directory
|
||||
APP_DIR=/opt/skymoney
|
||||
mkdir -p $APP_DIR
|
||||
|
||||
- name: Deploy Web
|
||||
run: |
|
||||
rm -rf /var/www/skymoney/dist/*
|
||||
# Sync repo to server (excluding node_modules, dist, etc)
|
||||
rsync -a --delete \
|
||||
--exclude=node_modules \
|
||||
--exclude=dist \
|
||||
--exclude=.git \
|
||||
--exclude=.gitea \
|
||||
--exclude=backups \
|
||||
--exclude=exporting \
|
||||
./ $APP_DIR/
|
||||
|
||||
# Copy built web to shared volume
|
||||
mkdir -p /var/www/skymoney/dist
|
||||
cp -r web/dist/* /var/www/skymoney/dist/
|
||||
|
||||
cd $APP_DIR
|
||||
|
||||
# Build and start all services
|
||||
docker compose up -d --build
|
||||
|
||||
# Wait for database to be ready
|
||||
sleep 10
|
||||
|
||||
# Run Prisma migrations inside the API container
|
||||
docker compose exec -T api npx prisma migrate deploy
|
||||
|
||||
- name: Reload Nginx
|
||||
run: sudo systemctl reload nginx
|
||||
Reference in New Issue
Block a user