name: Deploy Next.js via SSH (pnpm) on: push: branches: - main jobs: deploy: runs-on: ubuntu-latest steps: - name: Deploy via SSH auf dem Server uses: https://github.com/appleboy/ssh-action@v1.0.3 with: host: "172.17.0.1" # Die IP deines echten Servers aus Sicht des Docker-Containers username: "root" # Dein Server-Benutzername (z. B. root) # Erstelle ein Secret "SERVER_PASSWORD" in Gitea mit deinem Server-Passwort password: ${{ secrets.SERVER_PASSWORD }} script: | # 1. In das Verzeichnis auf dem ECHTEN Server wechseln # Falls der Ordner nicht existiert, erstellen wir ihn und klonen das Repo if [ ! -d "/var/www/psalmtafel" ]; then mkdir -p /var/www/psalmtafel cd /var/www/psalmtafel git clone http://localhost:3000/Schanbro/PsalmTafel.git . else cd /var/www/psalmtafel git pull origin main fi # 2. pnpm aktivieren und bauen corepack enable pnpm install --frozen-lockfile pnpm run build # 3. PM2 Neustart ohne Downtime pm2 reload psalmtafel || pm2 start pnpm --name "psalmtafel" -- start