Last active
April 11, 2017 14:23
-
-
Save michielgerritsen/e715c1c0cface95f3ce0588c6a05031e to your computer and use it in GitHub Desktop.
Retrieve the latest tag, based on the sorted version - https://packagist.org/packages/controlaltdelete/git-version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Retrieve the git version number so we can show it. | |
*/ | |
$files = []; | |
$dir = dirname(dirname(dirname(__FILE__))) . '/.git/refs/tags'; | |
if(file_exists($dir)) { | |
foreach (new DirectoryIterator($dir) as $file) { | |
if ($file->isDot()) { | |
continue; | |
} | |
$files[] = $file->getFilename(); | |
} | |
natsort($files); | |
\View::share('gitTag', end($files)); | |
} else { | |
\View::share('gitTag', 'v0.0.1'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment