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:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -8,38 +8,9 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Deploy via SSH
|
||||||
# ── 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
|
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.SSH_HOST }}
|
host: ${{ secrets.SSH_HOST }}
|
||||||
@@ -47,58 +18,16 @@ jobs:
|
|||||||
key: ${{ secrets.SSH_KEY }}
|
key: ${{ secrets.SSH_KEY }}
|
||||||
port: ${{ secrets.SSH_PORT }}
|
port: ${{ secrets.SSH_PORT }}
|
||||||
script: |
|
script: |
|
||||||
set -e
|
cd /var/www/vhosts/witstore.wende.it/httpdocs
|
||||||
DEPLOY_PATH="/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
|
||||||
echo "==> Wartungsmodus aktivieren"
|
git reset --hard origin/DEV
|
||||||
cd "$DEPLOY_PATH"
|
/opt/plesk/php/8.4/bin/php -d open_basedir="" /usr/local/psa/var/modules/composer/composer.phar install --no-dev --optimize-autoloader
|
||||||
php artisan down --render="errors::503" --retry=60 || true
|
/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
|
||||||
echo "==> Code aktualisieren"
|
/opt/plesk/php/8.4/bin/php -d open_basedir="" artisan route:cache
|
||||||
git pull origin DEV
|
/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"
|
||||||
echo "==> Composer (Produktion)"
|
npm ci
|
||||||
composer install --no-dev --optimize-autoloader --no-interaction
|
npm run build
|
||||||
|
echo "Deployment abgeschlossen: $(date)"
|
||||||
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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user