Align deploy workflow with dms.wende.it pattern
Deploy to Production (witstore.wende.it) / deploy (push) Failing after 2s
Deploy to Production (witstore.wende.it) / deploy (push) Failing after 2s
Uses same PHP path, Plesk composer, nodenv npm, GIT_TOKEN auth. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+16
-87
@@ -1,4 +1,4 @@
|
||||
name: Deploy to Plesk (witstore.wende.it)
|
||||
name: Deploy to Production (witstore.wende.it)
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -8,38 +8,9 @@ on:
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
# ── 1. Code auschecken ───────────────────────────────────────────
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# ── 2. PHP + Composer ────────────────────────────────────────────
|
||||
- name: PHP einrichten
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.3'
|
||||
extensions: mbstring, pdo, pdo_mysql, xml, curl, zip, gd
|
||||
coverage: none
|
||||
|
||||
- name: Composer Abhängigkeiten installieren
|
||||
run: composer install --no-dev --optimize-autoloader --no-interaction
|
||||
|
||||
# ── 3. Node / Assets bauen ───────────────────────────────────────
|
||||
- name: Node.js einrichten
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: NPM Abhängigkeiten installieren
|
||||
run: npm ci
|
||||
|
||||
- name: Assets bauen (Vite)
|
||||
run: npm run build
|
||||
|
||||
# ── 4. Deployment via SSH auf Plesk ──────────────────────────────
|
||||
- name: Deployment via SSH
|
||||
- name: Deploy via SSH
|
||||
uses: appleboy/ssh-action@v1.0.3
|
||||
with:
|
||||
host: ${{ secrets.SSH_HOST }}
|
||||
@@ -47,58 +18,16 @@ jobs:
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
port: ${{ secrets.SSH_PORT }}
|
||||
script: |
|
||||
set -e
|
||||
DEPLOY_PATH="/var/www/vhosts/witstore.wende.it/httpdocs"
|
||||
|
||||
echo "==> Wartungsmodus aktivieren"
|
||||
cd "$DEPLOY_PATH"
|
||||
php artisan down --render="errors::503" --retry=60 || true
|
||||
|
||||
echo "==> Code aktualisieren"
|
||||
git pull origin DEV
|
||||
|
||||
echo "==> Composer (Produktion)"
|
||||
composer install --no-dev --optimize-autoloader --no-interaction
|
||||
|
||||
echo "==> Assets kopieren (vom Runner vorbereitet)"
|
||||
# Assets wurden oben gebaut und sind jetzt im Repo (public/build)
|
||||
|
||||
echo "==> .env prüfen"
|
||||
if [ ! -f .env ]; then
|
||||
cp .env.example .env
|
||||
php artisan key:generate
|
||||
fi
|
||||
|
||||
echo "==> Datenbankmigrationen"
|
||||
php artisan migrate --force
|
||||
|
||||
echo "==> Cache leeren und neu aufbauen"
|
||||
php artisan config:cache
|
||||
php artisan route:cache
|
||||
php artisan view:cache
|
||||
php artisan event:cache
|
||||
|
||||
echo "==> Storage-Link sicherstellen"
|
||||
php artisan storage:link || true
|
||||
|
||||
echo "==> Berechtigungen setzen"
|
||||
chmod -R 755 storage bootstrap/cache
|
||||
chown -R $(whoami):psaserv storage bootstrap/cache 2>/dev/null || true
|
||||
|
||||
echo "==> Queue Worker neu starten"
|
||||
php artisan queue:restart || true
|
||||
|
||||
echo "==> Wartungsmodus deaktivieren"
|
||||
php artisan up
|
||||
|
||||
echo "==> Deployment erfolgreich abgeschlossen"
|
||||
|
||||
# ── 5. Status-Benachrichtigung ────────────────────────────────────
|
||||
- name: Deployment-Status melden
|
||||
if: always()
|
||||
run: |
|
||||
if [ "${{ job.status }}" == "success" ]; then
|
||||
echo "✅ Deployment auf witstore.wende.it erfolgreich"
|
||||
else
|
||||
echo "❌ Deployment fehlgeschlagen – bitte Logs prüfen"
|
||||
fi
|
||||
cd /var/www/vhosts/witstore.wende.it/httpdocs
|
||||
git remote set-url origin https://marco:${{ secrets.GIT_TOKEN }}@git.wende.it/marco/WitShop.git
|
||||
git fetch origin DEV
|
||||
git reset --hard origin/DEV
|
||||
/opt/plesk/php/8.4/bin/php -d open_basedir="" /usr/local/psa/var/modules/composer/composer.phar install --no-dev --optimize-autoloader
|
||||
/opt/plesk/php/8.4/bin/php -d open_basedir="" artisan migrate --force
|
||||
/opt/plesk/php/8.4/bin/php -d open_basedir="" artisan config:cache
|
||||
/opt/plesk/php/8.4/bin/php -d open_basedir="" artisan route:cache
|
||||
/opt/plesk/php/8.4/bin/php -d open_basedir="" artisan view:cache
|
||||
export PATH="$HOME/.nodenv/versions/24/bin:$HOME/.nodenv/shims:$HOME/.nodenv/bin:$PATH"
|
||||
npm ci
|
||||
npm run build
|
||||
echo "Deployment abgeschlossen: $(date)"
|
||||
|
||||
Reference in New Issue
Block a user