Files
WitShop/.gitea/workflows/deploy.yml
T
marcoandClaude Sonnet 4.6 c7e81ba3aa
Deploy to Plesk (witstore.wende.it) / deploy (push) Failing after 1m8s
Add Gitea Actions deployment workflow for witstore.wende.it
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 17:10:03 +02:00

105 lines
3.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Deploy to Plesk (witstore.wende.it)
on:
push:
branches:
- DEV
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
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
port: ${{ secrets.DEPLOY_PORT || 22 }}
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