From c1de0c1671cfa9c86460b69b5724b52db421eff8 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Wed, 15 Apr 2026 21:09:04 +0200 Subject: [PATCH] Enhance deploy-production.sh with error handling for git pull failures. Provide user guidance for SSH key setup and switching to HTTPS if necessary. Update code-analysis.yml to include Node.js setup with caching for improved workflow efficiency. --- .gitea/workflows/code-analysis.yml | 6 ++++++ deploy-production.sh | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/code-analysis.yml b/.gitea/workflows/code-analysis.yml index 3742069..bbbe5cf 100644 --- a/.gitea/workflows/code-analysis.yml +++ b/.gitea/workflows/code-analysis.yml @@ -12,6 +12,12 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + - name: Workspace sanity check run: | echo "PWD: $(pwd)" diff --git a/deploy-production.sh b/deploy-production.sh index f23c38c..440a2aa 100755 --- a/deploy-production.sh +++ b/deploy-production.sh @@ -137,7 +137,18 @@ git clean -fd \ # Pull latest changes echo " Pulling latest changes..." -git pull +if ! git pull --ff-only; then + echo "ERROR: git pull fehlgeschlagen." + echo "" + echo "Häufige Ursache: SSH-Key für den aktuellen User fehlt." + echo "Prüfen:" + echo " ssh -T git@tsschulz.de" + echo "" + echo "Optional auf HTTPS wechseln:" + echo " git remote set-url origin https://tsschulz.de//.git" + echo "Oder SSH-Key für User $(id -un) hinterlegen." + exit 1 +fi # Reset any accidental changes from stash restore (should be none now) git reset --hard HEAD >/dev/null 2>&1