mivita/app/Support/Monitoring/Release.php
Kevin e1c6178bc7 Git-Deploy per Tag: deploy.sh, Version aus RELEASE, Worker-Pruefung
- dev/betrieb/deploy.sh: Tag auschecken, composer, Caches leeren (bewusst
  kein route:/config:cache wegen hostabhaengiger Routen und env()-Aufrufen),
  horizon:terminate, FPM-Reload, Worker-Pruefung am Ende
- dev/betrieb/README.md: Einrichtung Server, Umstellung des Live-Verzeichnisses,
  Release, Deploy, Rollback
- config('app.version') aus RELEASE, php artisan about --only=mivita
- monitoring:queue-probe prueft nach dem Deploy, ob Horizon Jobs abholt
- Vorlage dev/git-deploy-monitoring aus Pressekonto

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 10:11:34 +00:00

31 lines
855 B
PHP

<?php
namespace App\Support\Monitoring;
/**
* Versionskennung des ausgelieferten Stands — `config('app.version')`.
* Vorrang hat der konfigurierte Wert (APP_VERSION); sonst die Datei
* `RELEASE` im Projektwurzelverzeichnis, die dev/betrieb/deploy.sh beim
* Deploy mit dem Tag beschreibt (z. B. „v1.2.0“).
*/
class Release
{
public static function current(?string $configured, ?string $basePath = null): ?string
{
$configured = trim((string) $configured);
if ($configured !== '') {
return $configured;
}
$file = rtrim($basePath ?? base_path(), '/').'/RELEASE';
if (! is_file($file)) {
return null;
}
$release = trim((string) file_get_contents($file));
return preg_match('/^[A-Za-z0-9._\-]{1,64}$/', $release) === 1 ? $release : null;
}
}