Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save robertannett/309db7c2f30341cb77402c8ba0c08866 to your computer and use it in GitHub Desktop.
Save robertannett/309db7c2f30341cb77402c8ba0c08866 to your computer and use it in GitHub Desktop.
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ApplicationVersion extends \Base
{
public static function get()
{
$commitHash = trim(exec('git log --pretty="%h" -n1 HEAD'));
$release = trim(exec('git tag'));
return sprintf('%s-r%s', $commitHash, $release);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment