Read the version base from the install for the deployment

This commit is contained in:
Nabeel Shahzad
2018-02-03 13:16:37 -06:00
parent 43ecc35fe9
commit 512d8a2172
3 changed files with 29 additions and 19 deletions

View File

@@ -40,8 +40,9 @@ jobs:
- if [ "$TRAVIS_BRANCH" = "dev" ]; then ./.travis/deploy_script.sh; fi
- if [ "$TRAVIS_BRANCH" = "master" ]; then ./.travis/deploy_script.sh; fi
on:
php: '7.0'
- stage: deploy-release
all_branches: true
php: '7.0'
- stage: release
script: skip
before_deploy:
- curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash
@@ -54,6 +55,6 @@ jobs:
file_glob: true
file: build/*
on:
tags: true
repo: nabeelio/phpvms
php: '7.0'
tags: true
repo: nabeelio/phpvms
php: '7.0'

View File

@@ -2,26 +2,28 @@
if [ "$TRAVIS" = "true" ]; then
cd $TRAVIS_BUILD_DIR
if test "$TRAVIS_TAG"; then
PKG_NAME=$TRAVIS_TAG
else
PKG_NAME=v7.0.0-$TRAVIS_BRANCH
BASE_VERSION=`php artisan phpvms:version --base-only`
PKG_NAME=$BASE_VERSION-$TRAVIS_BRANCH
fi
FILE_NAME="phpvms-$PKG_NAME"
TAR_NAME="$FILE_NAME.tar.gz"
echo "Writing $TAR_NAME"
cd $TRAVIS_BUILD_DIR
php artisan phpvms:version --write > VERSION
VERSION=`cat VERSION`
echo "Version: $VERSION"
echo "Cleaning files"
make clean
rm -rf env.php
rm -rf env.php config.php
find ./vendor -type d -name ".git" -print0 | xargs rm -rf
find . -type d -name "sass-cache" -print0 | xargs rm -rf

View File

@@ -7,7 +7,7 @@ use Symfony\Component\Yaml\Yaml;
class Version extends BaseCommand
{
protected $signature = 'phpvms:version {--write}';
protected $signature = 'phpvms:version {--write} {--base-only}';
/**
* Create the version number that gets written out
@@ -31,20 +31,27 @@ class Version extends BaseCommand
*/
public function handle()
{
$version_file = config_path('version.yml');
$cfg = Yaml::parse(file_get_contents($version_file));
if($this->option('write')) {
$version_file = config_path('version.yml');
$cfg = Yaml::parse(file_get_contents($version_file));
$version = $this->createVersionNumber($cfg);
$cfg['build']['number'] = $version;
file_put_contents($version_file, Yaml::dump($cfg, 4, 2));
}
$this->call('version:show', [
'--format' => 'compact',
'--suppress-app-name' => true
]);
# Only show the major.minor.patch version
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
]);
}
}
}