- old server 188.245.242.194 is unreachable (cp-server-1 ALT, forensic only) - switch SSH user from haustest to root (chown added in new step) - add composer install --no-dev (vendor/ is gitignored) - update ssh-keyscan to new IP + port
143 lines
5.2 KiB
YAML
Executable File
143 lines
5.2 KiB
YAML
Executable File
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
|
|
env:
|
|
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
|
|
run: |
|
|
if [ -z "$DEPLOY_SSH_KEY" ]; then
|
|
echo "⚠️ DEPLOY_SSH_KEY secret not set — skipping deploy step"
|
|
echo "skip_deploy=1" >> $GITHUB_ENV
|
|
exit 0
|
|
fi
|
|
mkdir -p ~/.ssh
|
|
echo "$DEPLOY_SSH_KEY" > ~/.ssh/id_ed25519
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
ssh-keyscan -H -p 9716 46.225.136.66 >> ~/.ssh/known_hosts 2>/dev/null
|
|
echo "✅ SSH key configured"
|
|
|
|
- name: Verify SSH connectivity
|
|
if: env.skip_deploy != '1'
|
|
run: |
|
|
ssh -o StrictHostKeyChecking=yes -i ~/.ssh/id_ed25519 -p 9716 \
|
|
root@46.225.136.66 "echo 'SSH-OK as:' \$(whoami) 'on' \$(hostname)"
|
|
|
|
- name: Backup current test deployment
|
|
if: env.skip_deploy != '1'
|
|
run: |
|
|
ssh -i ~/.ssh/id_ed25519 -p 9716 root@46.225.136.66 \
|
|
"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
|
|
if: env.skip_deploy != '1'
|
|
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 -p 9716" \
|
|
./ root@46.225.136.66:/home/haustest/htdocs/haus.test.kies-media.de/
|
|
|
|
- name: Fix ownership and install dependencies
|
|
if: env.skip_deploy != '1'
|
|
run: |
|
|
ssh -i ~/.ssh/id_ed25519 -p 9716 root@46.225.136.66 \
|
|
"cd /home/haustest/htdocs/haus.test.kies-media.de && \
|
|
COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev --no-interaction --no-progress && \
|
|
chown -R haustest:haustest /home/haustest/htdocs/haus.test.kies-media.de"
|
|
|
|
- name: Smoke test
|
|
if: env.skip_deploy != '1'
|
|
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 '<html lang="[a-z]+"' | head -1)
|
|
echo " locale=$loc → $lang"
|
|
done
|
|
echo ""
|
|
echo "🎉 Test deployment verified: https://haus.test.kies-media.de"
|
|
|
|
- name: Deployment summary
|
|
if: always()
|
|
run: |
|
|
echo "### 🚀 Deployment Summary" >> $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:** root@46.225.136.66:9716 (cp3)" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "**Review URL:** https://haus.test.kies-media.de" >> $GITHUB_STEP_SUMMARY
|