name: Deploy Feature Branch to Test (haus.test.kies-media.de) on: push: branches: - "feature/**" workflow_dispatch: inputs: ref: description: "Branch or tag to deploy (default: HEAD)" required: false default: "" jobs: deploy: name: Deploy to Test Environment runs-on: ubuntu-latest concurrency: group: deploy-test cancel-in-progress: false steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 1 - name: Setup SSH run: | mkdir -p ~/.ssh echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519 ssh-keyscan -H 188.245.242.194 >> ~/.ssh/known_hosts 2>/dev/null echo "✅ SSH key configured" - name: Verify SSH connectivity run: | ssh -o StrictHostKeyChecking=yes -i ~/.ssh/id_ed25519 \ haustest@188.245.242.194 "echo 'SSH-OK as:' \$(whoami) 'on' \$(hostname)" - name: Backup current test deployment run: | ssh -i ~/.ssh/id_ed25519 haustest@188.245.242.194 \ "cd /home/haustest/htdocs && \ tar czf /home/haustest/backup-pre-deploy-\$(date +%Y%m%d-%H%M%S).tar.gz \ haus.test.kies-media.de && \ ls -lh /home/haustest/backup-pre-deploy-*.tar.gz | tail -1" - name: Rsync to test environment run: | rsync -avz --delete \ --exclude='.git' \ --exclude='node_modules' \ --exclude='tests' \ --exclude='docs' \ --exclude='.gitea' \ --exclude='.continue' \ --exclude='.husky' \ --exclude='Dockerfile' \ --exclude='.dockerignore' \ --exclude='nginx.conf' \ --exclude='eslint.config.js' \ --exclude='package.json' \ --exclude='package-lock.json' \ --exclude='phpunit.xml' \ --exclude='scripts' \ --exclude='AGENTS.md' \ --exclude='README.md' \ --exclude='CLAUDE.md' \ --exclude='*.md' \ --exclude='.htmlhintrc' \ --exclude='.prettierrc' \ --exclude='.prettierignore' \ --exclude='.stylelintrc.json' \ --exclude='.editorconfig' \ --exclude='.well-known' \ -e "ssh -i ~/.ssh/id_ed25519" \ ./ haustest@188.245.242.194:/home/haustest/htdocs/haus.test.kies-media.de/ - name: Smoke test run: | sleep 2 echo "--- HTTP status codes ---" for path in "/" "/impressum" "/datenschutz"; do code=$(curl -s -o /dev/null -w "%{http_code}" \ -H "Cache-Control: no-cache" \ "https://haus.test.kies-media.de${path}") echo " $path → HTTP $code" if [ "$code" != "200" ]; then echo "❌ Smoke test failed for $path" exit 1 fi done echo "" echo "--- Locale switcher present? ---" if curl -sL "https://haus.test.kies-media.de/" | grep -q "class=\"locale-switcher\""; then echo " ✅ Locale switcher rendered" else echo " ❌ Locale switcher MISSING" exit 1 fi echo "" echo "--- All 4 locales serving? ---" for loc in de en uk ru; do lang=$(curl -sL -H "Cache-Control: no-cache" \ -b "locale=$loc" \ "https://haus.test.kies-media.de/" \ | grep -oE '> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "- **Target:** https://haus.test.kies-media.de" >> $GITHUB_STEP_SUMMARY echo "- **Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY echo "- **Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY echo "- **Server:** haustest@188.245.242.194" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "**Review URL:** https://haus.test.kies-media.de" >> $GITHUB_STEP_SUMMARY