name: Deploy Bürgerwind

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Code holen
        uses: actions/checkout@v4

      - name: .env erstellen
        run: |
          echo "DB_HOST=${{ secrets.DB_HOST }}" > .env
          echo "DB_PORT=5432" >> .env
          echo "DB_USER=${{ secrets.DB_USER }}" >> .env
          echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> .env
          echo "DB_NAME=${{ secrets.DB_NAME }}" >> .env
          echo "DB_SCHEMA=geodaten" >> .env

      - name: App bauen und starten
        run: |
          docker compose up -d --build --force-recreate