Fix version number generation
This commit is contained in:
@@ -19,7 +19,6 @@ class Version extends BaseCommand
|
|||||||
|
|
||||||
# prefix with the date in YYMMDD format
|
# prefix with the date in YYMMDD format
|
||||||
$date = date('ymd');
|
$date = date('ymd');
|
||||||
|
|
||||||
$version = $date.'-'.$version;
|
$version = $date.'-'.$version;
|
||||||
|
|
||||||
return $version;
|
return $version;
|
||||||
@@ -34,24 +33,17 @@ class Version extends BaseCommand
|
|||||||
$version_file = config_path('version.yml');
|
$version_file = config_path('version.yml');
|
||||||
$cfg = Yaml::parse(file_get_contents($version_file));
|
$cfg = Yaml::parse(file_get_contents($version_file));
|
||||||
|
|
||||||
|
# Get the current build id
|
||||||
|
$build_number = $this->createVersionNumber($cfg);
|
||||||
|
$cfg['build']['number'] = $build_number;
|
||||||
|
|
||||||
|
$c = $cfg['current'];
|
||||||
|
$version = "v{$c['major']}.{$c['minor']}.{$c['patch']}-{$build_number}";
|
||||||
|
|
||||||
if($this->option('write')) {
|
if($this->option('write')) {
|
||||||
$version = $this->createVersionNumber($cfg);
|
|
||||||
$cfg['build']['number'] = $version;
|
|
||||||
file_put_contents($version_file, Yaml::dump($cfg, 4, 2));
|
file_put_contents($version_file, Yaml::dump($cfg, 4, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
# Only show the major.minor.patch version
|
print $version."\n";
|
||||||
if($this->option('base-only')) {
|
|
||||||
$version = 'v'.$cfg['current']['major'] . '.'
|
|
||||||
.$cfg['current']['minor'] . '.'
|
|
||||||
.$cfg['current']['patch'];
|
|
||||||
|
|
||||||
print $version;
|
|
||||||
} else {
|
|
||||||
$this->call('version:show', [
|
|
||||||
'--format' => 'compact',
|
|
||||||
'--suppress-app-name' => true
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user