Use current commit hash as version "number" when MODE is prerelease

This commit is contained in:
Bernd Bestel 2018-09-25 08:55:25 +02:00
parent 037d024862
commit 8d41dcc650
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
# Either "production" or "dev" # Either "production", "dev" or "prerelease"
Setting('MODE', 'production'); Setting('MODE', 'production');
# Either "en" or "de" or the filename (without extension) of # Either "en" or "de" or the filename (without extension) of

View File

@ -17,9 +17,18 @@ class BaseController
$applicationService = new ApplicationService(); $applicationService = new ApplicationService();
$versionInfo = $applicationService->GetInstalledVersion(); $versionInfo = $applicationService->GetInstalledVersion();
$container->view->set('version', $versionInfo->Version);
$container->view->set('releaseDate', $versionInfo->ReleaseDate); $container->view->set('releaseDate', $versionInfo->ReleaseDate);
if (GROCY_MODE === 'prerelease')
{
$commitHash = trim(exec('git log --pretty="%h" -n1 HEAD'));
$container->view->set('version', "pre-release-$commitHash");
}
else
{
$container->view->set('version', $versionInfo->Version);
}
$container->view->set('localizationStrings', $localizationService->GetCurrentCultureLocalizations()); $container->view->set('localizationStrings', $localizationService->GetCurrentCultureLocalizations());
$container->view->set('L', function($text, ...$placeholderValues) use($localizationService) $container->view->set('L', function($text, ...$placeholderValues) use($localizationService)
{ {