New CI
Some checks failed
CI / Build and Deploy (push) Failing after 33s

This commit is contained in:
2026-05-05 14:10:55 +02:00
parent e447c1d994
commit 375ae8a424

View File

@@ -7,20 +7,24 @@ on:
pull_request: pull_request:
jobs: jobs:
build: build-deploy:
name: Build name: Build and Deploy
runs-on: ubuntu runs-on: ubuntu
env: env:
NEXT_TELEMETRY_DISABLED: 1 NEXT_TELEMETRY_DISABLED: 1
DATABASE_URL: ${{ secrets.DATABASE_URL }} NODE_ENV: production
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Load local runtime env
run: |
set -a
. /opt/RFP_Finanzen/.env
set +a
- name: Show environment - name: Show environment
run: | run: |
whoami whoami
@@ -28,7 +32,7 @@ jobs:
pwd pwd
node -v node -v
npm -v npm -v
- name: Clean old build artifacts - name: Clean old build artifacts
run: rm -rf .next run: rm -rf .next
@@ -41,73 +45,41 @@ jobs:
- name: Build app - name: Build app
run: npm run build run: npm run build
deploy: - name: Deploy to target directory
name: Deploy if: gitea.event_name == 'push'
if: gitea.event_name == 'push'
needs: build
runs-on: ubuntu
env:
NEXT_TELEMETRY_DISABLED: 1
DATABASE_URL: ${{ secrets.DATABASE_URL }}
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Sync project to target directory
run: | run: |
rsync -av --delete \ rsync -av --delete \
--exclude ".git" \ --exclude ".git" \
--exclude ".github" \ --exclude ".github" \
--exclude "node_modules" \
--exclude ".next" \
--exclude ".env" \ --exclude ".env" \
--exclude "node_modules" \
./ /opt/RFP_Finanzen/ ./ /opt/RFP_Finanzen/
- name: Write runtime .env - name: Install production dependencies on target
run: | if: gitea.event_name == 'push'
cat > /opt/RFP_Finanzen/.env <<EOF
DATABASE_URL=${{ secrets.DATABASE_URL }}
NEXTAUTH_URL=${{ secrets.NEXTAUTH_URL }}
NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }}
NODE_ENV=production
EOF
chmod 600 /opt/RFP_Finanzen/.env
- name: Install dependencies on target
run: | run: |
cd /opt/RFP_Finanzen cd /opt/RFP_Finanzen
npm install npm install
- name: Prisma generate on target
run: |
cd /opt/RFP_Finanzen
npx prisma generate
- name: Build app on target
run: |
cd /opt/RFP_Finanzen
rm -rf .next
npm run build
- name: Run Prisma migrations on target - name: Run Prisma migrations on target
if: gitea.event_name == 'push'
run: | run: |
cd /opt/RFP_Finanzen cd /opt/RFP_Finanzen
set -a
. ./.env
set +a
npx prisma migrate deploy npx prisma migrate deploy
- name: Restart service - name: Restart service
if: gitea.event_name == 'push'
run: sudo systemctl restart finanzen-app run: sudo systemctl restart finanzen-app
- name: Show service status - name: Show service status
run: sudo systemctl --no-pager --full status finanzen-app if: gitea.event_name == 'push'
- name: Show service status
run: sudo systemctl --no-pager --full status finanzen-app run: sudo systemctl --no-pager --full status finanzen-app
- name: Test local app endpoint - name: Test local app endpoint
if: gitea.event_name == 'push'
run: | run: |
sleep 3 sleep 3
curl -I http://127.0.0.1:3000 curl -I http://127.0.0.1:3000