* Check for null version from upstream #575 * Fix for pre-release version numbering * Move popup to right * Split get/generate build ID #575
This commit is contained in:
parent
b9fe8bf738
commit
0e13905098
@ -7,11 +7,10 @@ fi
|
|||||||
cd $TRAVIS_BUILD_DIR
|
cd $TRAVIS_BUILD_DIR
|
||||||
|
|
||||||
if test "$TRAVIS_TAG"; then
|
if test "$TRAVIS_TAG"; then
|
||||||
PKG_NAME=$TRAVIS_TAG
|
|
||||||
VERSION=$TRAVIS_TAG
|
VERSION=$TRAVIS_TAG
|
||||||
|
|
||||||
# Pass in the tag as the version to write out
|
# Pass in the tag as the version to write out
|
||||||
php artisan phpvms:version --write $VERSION
|
php artisan phpvms:version --write --write-full-version "${VERSION}"
|
||||||
else
|
else
|
||||||
echo "On branch $TRAVIS_BRANCH"
|
echo "On branch $TRAVIS_BRANCH"
|
||||||
|
|
||||||
@ -25,19 +24,20 @@ else
|
|||||||
BASE_VERSION=$(php artisan phpvms:version --base-only)
|
BASE_VERSION=$(php artisan phpvms:version --base-only)
|
||||||
|
|
||||||
# This now includes the pre-release version, so "-dev" by default
|
# This now includes the pre-release version, so "-dev" by default
|
||||||
PKG_NAME=${BASE_VERSION}
|
VERSION=${BASE_VERSION}
|
||||||
|
|
||||||
# Don't pass in a version here, just write out the latest hash
|
# Don't pass in a version here, just write out the latest hash
|
||||||
php artisan phpvms:version --write >VERSION
|
php artisan phpvms:version --write "${VERSION}"
|
||||||
VERSION=$(cat VERSION)
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
FILE_NAME="phpvms-${VERSION}"
|
||||||
|
TAR_NAME="$FILE_NAME.tar.gz"
|
||||||
|
ZIP_NAME="$FILE_NAME.zip"
|
||||||
|
|
||||||
echo "Version: $VERSION"
|
echo "Version: $VERSION"
|
||||||
echo "Package name: $TAR_NAME"
|
echo "Package name: $TAR_NAME"
|
||||||
|
|
||||||
FILE_NAME="phpvms-$PKG_NAME"
|
echo "==========================="
|
||||||
TAR_NAME="$FILE_NAME.tar.gz"
|
|
||||||
ZIP_NAME="$FILE_NAME.zip"
|
|
||||||
|
|
||||||
echo "Cleaning files"
|
echo "Cleaning files"
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class Version extends Command
|
|||||||
// If a version is being passed in, the update the build, etc data against this
|
// If a version is being passed in, the update the build, etc data against this
|
||||||
if ($this->argument('version')) {
|
if ($this->argument('version')) {
|
||||||
$version = \SemVer\SemVer\Version::fromString($this->argument('version'));
|
$version = \SemVer\SemVer\Version::fromString($this->argument('version'));
|
||||||
if ($this->option('write_full_version')) {
|
if ($this->option('write-full-version')) {
|
||||||
$cfg['current']['major'] = $version->getMajor();
|
$cfg['current']['major'] = $version->getMajor();
|
||||||
$cfg['current']['minor'] = $version->getMinor();
|
$cfg['current']['minor'] = $version->getMinor();
|
||||||
$cfg['current']['patch'] = $version->getPatch();
|
$cfg['current']['patch'] = $version->getPatch();
|
||||||
@ -51,7 +51,7 @@ class Version extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Always write out the build ID/build number which is the commit hash
|
// Always write out the build ID/build number which is the commit hash
|
||||||
$build_number = $this->versionSvc->getBuildId($cfg);
|
$build_number = $this->versionSvc->generateBuildId($cfg);
|
||||||
$cfg['current']['commit'] = $build_number;
|
$cfg['current']['commit'] = $build_number;
|
||||||
$cfg['build']['number'] = $build_number;
|
$cfg['build']['number'] = $build_number;
|
||||||
|
|
||||||
|
22
app/Http/Composers/VersionComposer.php
Normal file
22
app/Http/Composers/VersionComposer.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Composers;
|
||||||
|
|
||||||
|
use App\Services\VersionService;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class VersionComposer
|
||||||
|
{
|
||||||
|
protected $versionSvc;
|
||||||
|
|
||||||
|
public function __construct(VersionService $versionSvc)
|
||||||
|
{
|
||||||
|
$this->versionSvc = $versionSvc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function compose(View $view)
|
||||||
|
{
|
||||||
|
$view->with('version', $this->versionSvc->getCurrentVersion(false));
|
||||||
|
$view->with('version_full', $this->versionSvc->getCurrentVersion(true));
|
||||||
|
}
|
||||||
|
}
|
16
app/Providers/ComposerServiceProvider.php
Normal file
16
app/Providers/ComposerServiceProvider.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use App\Http\Composers\VersionComposer;
|
||||||
|
use Illuminate\Support\Facades\View;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class ComposerServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
// Attach the version number to the admin sidebar
|
||||||
|
View::composer('admin.sidebar', VersionComposer::class);
|
||||||
|
}
|
||||||
|
}
|
@ -76,7 +76,7 @@ class VersionService extends Service
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download the latest version from github
|
* Download the latest version from github and return the version number
|
||||||
*/
|
*/
|
||||||
private function getLatestVersionGithub()
|
private function getLatestVersionGithub()
|
||||||
{
|
{
|
||||||
@ -112,7 +112,7 @@ class VersionService extends Service
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $releases;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,12 +133,30 @@ class VersionService extends Service
|
|||||||
*/
|
*/
|
||||||
public function getBuildId($cfg)
|
public function getBuildId($cfg)
|
||||||
{
|
{
|
||||||
|
return $cfg['build']['number'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a build ID
|
||||||
|
*
|
||||||
|
* @param array $cfg The version config
|
||||||
|
*
|
||||||
|
* @return false|string
|
||||||
|
*/
|
||||||
|
public function generateBuildId($cfg)
|
||||||
|
{
|
||||||
|
$date = date('ymd');
|
||||||
exec($cfg['git']['git-local'], $version);
|
exec($cfg['git']['git-local'], $version);
|
||||||
|
if (empty($version)) {
|
||||||
|
return $date;
|
||||||
|
}
|
||||||
|
|
||||||
$version = substr($version[0], 0, $cfg['build']['length']);
|
$version = substr($version[0], 0, $cfg['build']['length']);
|
||||||
|
|
||||||
// prefix with the date in YYMMDD format
|
// prefix with the date in YYMMDD format
|
||||||
$date = date('ymd');
|
$version = $date.'.'.$version;
|
||||||
return $date.'.'.$version;
|
|
||||||
|
return $version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -165,8 +183,9 @@ class VersionService extends Service
|
|||||||
if ($include_build) {
|
if ($include_build) {
|
||||||
// Get the current build id
|
// Get the current build id
|
||||||
$build_number = $this->getBuildId($cfg);
|
$build_number = $this->getBuildId($cfg);
|
||||||
$cfg['build']['number'] = $build_number;
|
if (!empty($build_number)) {
|
||||||
$version = $version.'+'.$build_number;
|
$version = $version.'+'.$build_number;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $version;
|
return $version;
|
||||||
@ -188,9 +207,12 @@ class VersionService extends Service
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Replace "dev" with "alpha", since
|
// Replace "dev" with "alpha", since
|
||||||
|
|
||||||
$latest_version = $this->getLatestVersion();
|
$latest_version = $this->getLatestVersion();
|
||||||
|
|
||||||
|
if (empty($latest_version)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Convert to semver
|
// Convert to semver
|
||||||
if ($this->isGreaterThan($latest_version, $current_version)) {
|
if ($this->isGreaterThan($latest_version, $current_version)) {
|
||||||
$this->kvpRepo->save('new_version_available', true);
|
$this->kvpRepo->save('new_version_available', true);
|
||||||
|
@ -77,6 +77,7 @@ return [
|
|||||||
App\Providers\AuthServiceProvider::class,
|
App\Providers\AuthServiceProvider::class,
|
||||||
App\Providers\BindServiceProviders::class,
|
App\Providers\BindServiceProviders::class,
|
||||||
App\Providers\BroadcastServiceProvider::class,
|
App\Providers\BroadcastServiceProvider::class,
|
||||||
|
App\Providers\ComposerServiceProvider::class,
|
||||||
App\Providers\CronServiceProvider::class,
|
App\Providers\CronServiceProvider::class,
|
||||||
App\Providers\DirectiveServiceProvider::class,
|
App\Providers\DirectiveServiceProvider::class,
|
||||||
App\Providers\EventServiceProvider::class,
|
App\Providers\EventServiceProvider::class,
|
||||||
|
@ -29,4 +29,4 @@ format:
|
|||||||
build: '{$build}'
|
build: '{$build}'
|
||||||
version: '{$major}.{$minor}.{$patch} (build {$build})'
|
version: '{$major}.{$minor}.{$patch} (build {$build})'
|
||||||
full: 'version {{''format.version''}}'
|
full: 'version {{''format.version''}}'
|
||||||
compact: 'v{$major}.{$minor}.{$patch}+{$build}'
|
compact: '{$major}.{$minor}.{$patch}+{$build}'
|
||||||
|
@ -110,6 +110,8 @@
|
|||||||
checkboxClass: 'icheckbox_square-blue',
|
checkboxClass: 'icheckbox_square-blue',
|
||||||
radioClass: 'icheckbox_square-blue'
|
radioClass: 'icheckbox_square-blue'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('[data-toggle="popover"]').popover();
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
@ -19,9 +19,15 @@
|
|||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row" style="margin-bottom: 20px;">
|
||||||
<div class="col-xs-12 text-center">
|
<div class="col-xs-12 text-center">
|
||||||
<p class="small">@version</p>
|
<a class="small"
|
||||||
|
data-container="body"
|
||||||
|
data-toggle="popover"
|
||||||
|
data-placement="right"
|
||||||
|
data-content="{{$version_full}}">
|
||||||
|
version {{ $version }}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user