mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 10:23:14 -04:00
15 lines
483 B
JavaScript
15 lines
483 B
JavaScript
import { execSync as exec } from 'child_process';
|
|
|
|
export default (grunt) => {
|
|
const pkgVersion = grunt.config.get('pkg.version');
|
|
|
|
const sha = String(exec('git rev-parse HEAD')).trim();
|
|
const number = parseFloat(String(exec('git log --format="%h" | wc -l')).trim());
|
|
const version = buildVersion(grunt.option('release'), pkgVersion);
|
|
|
|
return { sha, number, version };
|
|
};
|
|
|
|
function buildVersion(isRelease, version) {
|
|
return isRelease ? version : `${version}-SNAPSHOT`;
|
|
}
|