78 lines
1.7 KiB
YAML
78 lines
1.7 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: 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
|
|
npm install
|
|
|
|
- name: Prisma generate
|
|
if: gitea.event_name == 'push'
|
|
run: |
|
|
cd /opt/RFP_Finanzen
|
|
npx prisma generate
|
|
|
|
- name: Run Prisma migrations
|
|
if: gitea.event_name == 'push'
|
|
run: |
|
|
cd /opt/RFP_Finanzen
|
|
npx prisma migrate deploy
|
|
|
|
- name: Build app
|
|
if: gitea.event_name == 'push'
|
|
run: |
|
|
cd /opt/RFP_Finanzen
|
|
rm -rf node_modules .next
|
|
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 |