diff --git a/app/Console/Commands/UpdateVersionFile.php b/app/Console/Commands/UpdateVersionFile.php new file mode 100644 index 00000000..a1585bee --- /dev/null +++ b/app/Console/Commands/UpdateVersionFile.php @@ -0,0 +1,33 @@ +warn('Not inside a Git repository, skipping'); + + return 0; + } + + $version = trim(shell_exec('git describe --always --tags')); + + $versionFile = fopen('version.txt', 'w'); + + fwrite($versionFile, $version); + + fclose($versionFile); + + $this->info('Detected ' . $version . ' and wrote to version file'); + + return 0; + } +} diff --git a/composer.json b/composer.json index 6ef610f0..dbdd1e04 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,7 @@ ], "post-install-cmd": [ "Illuminate\\Foundation\\ComposerScripts::postInstall", - "git rev-parse --is-inside-work-tree >/dev/null 2>&1 && git describe --always --tags > version.txt" + "php artisan app:update-version-file" ], "post-update-cmd": [ "Illuminate\\Foundation\\ComposerScripts::postUpdate"