name: CI on: push: branches: - main pull_request: jobs: build-deploy: name: Build and Deploy runs-on: ubuntu env: NEXT_TELEMETRY_DISABLED: 1 NODE_ENV: production steps: - name: Checkout uses: actions/checkout@v4 - name: Show environment run: | whoami hostname pwd node -v npm -v - name: Deploy source to target directory if: gitea.event_name == 'push' run: | rsync -av --delete \ --exclude ".git" \ --exclude ".github" \ --exclude ".env" \ --exclude "node_modules" \ --exclude ".next" \ ./ /opt/RFP_Finanzen/ - name: Install dependencies if: gitea.event_name == 'push' run: | cd /opt/RFP_Finanzen rm -rf node_modules .next npm ci - name: Debug before build if: gitea.event_name == 'push' run: | cd /opt/RFP_Finanzen echo "PWD:" pwd echo "src/lib:" ls -la src/lib || true echo "tsconfig:" cat tsconfig.json || true echo "next config:" cat next.config.mjs || true echo "Check files:" test -f src/lib/audit-log.ts && echo "audit-log OK" || echo "audit-log FEHLT" test -f src/lib/domain.ts && echo "domain OK" || echo "domain FEHLT" test -f src/lib/prisma.ts && echo "prisma OK" || echo "prisma FEHLT" test -f src/lib/session.ts && echo "session OK" || echo "session FEHLT" test -f src/lib/auth.ts && echo "auth OK" || echo "auth FEHLT" - name: Build app if: gitea.event_name == 'push' run: | cd /opt/RFP_Finanzen npx prisma generate npx prisma migrate deploy npm run build - name: Restart service if: gitea.event_name == 'push' run: sudo systemctl restart finanzen-app - name: Show service status if: gitea.event_name == 'push' run: sudo systemctl --no-pager --full status finanzen-app - name: Test local app endpoint if: gitea.event_name == 'push' run: | sleep 3 curl -I http://127.0.0.1:3000