Files
RFP_Finanzen/.gitea/workflows/ci.yaml
Winz 375ae8a424
Some checks failed
CI / Build and Deploy (push) Failing after 33s
New CI
2026-05-05 14:10:55 +02:00

85 lines
1.8 KiB
YAML

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: Load local runtime env
run: |
set -a
. /opt/RFP_Finanzen/.env
set +a
- name: Show environment
run: |
whoami
hostname
pwd
node -v
npm -v
- name: Clean old build artifacts
run: rm -rf .next
- name: Install dependencies
run: npm install
- name: Prisma generate
run: npx prisma generate
- name: Build app
run: npm run build
- name: Deploy to target directory
if: gitea.event_name == 'push'
run: |
rsync -av --delete \
--exclude ".git" \
--exclude ".github" \
--exclude ".env" \
--exclude "node_modules" \
./ /opt/RFP_Finanzen/
- name: Install production dependencies on target
if: gitea.event_name == 'push'
run: |
cd /opt/RFP_Finanzen
npm install
- name: Run Prisma migrations on target
if: gitea.event_name == 'push'
run: |
cd /opt/RFP_Finanzen
set -a
. ./.env
set +a
npx prisma migrate deploy
- 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