diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-12-08 08:34:47 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-08 08:34:47 +0000 |
commit | a60d0523c1afb6c1983b522d1477b8ef319d5b99 (patch) | |
tree | 8b268a842014cff3431e898e4b7f3e267ee7cd81 /bin/rr | |
parent | b22078ce707d21ac17ea1727a4174c44ef57ae69 (diff) | |
parent | d410a76d7ccef826fc5b1921314f88a902f1d10c (diff) |
Merge #433
433: Releases and binaries build automation r=48d90782 a=tarampampam
This PR contains:
- [x] CI steps for automatic release distributive creation and uploading to github release
- [x] CI step for automatic docker image creation (on GitHub side, not `hub.docker.com`)
- [x] `build.sh` script removal
- [x] Binary file building in `Dockerfile` using `go build` (not `build.sh`)
- [x] Docker labels with app version and build time
- [x] `Makefile` cleaning
- [x] `./bin/rr` now do not depends from `build.sh` file and use [`composer/package-versions-deprecated`](https://github.com/composer/package-versions-deprecated) package for "self version reading"
> :warning: Steps, that must be done before merging described [here](https://github.com/spiral/roadrunner/pull/433#issuecomment-740426206)
Closes #431
Co-authored-by: paramtamtam <[email protected]>
Co-authored-by: Paramtamtam <[email protected]>
Diffstat (limited to 'bin/rr')
-rwxr-xr-x | bin/rr | 30 |
1 files changed, 16 insertions, 14 deletions
@@ -11,7 +11,8 @@ declare(strict_types=1); foreach ([ __DIR__ . '/../../../autoload.php', __DIR__ . '/../vendor/autoload.php', - __DIR__ . '/vendor/autoload.php' + __DIR__ . '/vendor/autoload.php', + __DIR__ . '/../vendor_php/autoload.php' ] as $file) { if (file_exists($file)) { define('RR_COMPOSER_INSTALL', $file); @@ -51,28 +52,29 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; +use function Couchbase\defaultDecoder; class RRHelper { /** - * Returns version of RoadRunner based on build.sh file + * @var string + */ + public const SELF_PACKAGE_NAME = 'spiral/roadrunner'; + + /** + * Returns version of RoadRunner based on current package version. * - * @return string Version of RoadRunner - * @throws Exception + * @return string Version of RoadRunner (eg.: `1.8.0`) */ public static function getVersion(): string { - $file = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'build.sh'; - $fileResource = fopen($file, 'r') or die(1); - while (!feof($fileResource)) { - $line = fgets($fileResource, 4096); - $matches = []; - if (preg_match("/^RR_VERSION=(.*)/", $line, $matches)) { - return trim($matches[1]); - } + $version = \PackageVersions\Versions::getVersion(self::SELF_PACKAGE_NAME); + + if (\is_int($delimiter_position = \mb_strpos($version, '@'))) { + $version = \mb_substr($version, 0, (int) $delimiter_position); } - fclose($fileResource); - throw new Exception("Can't find version of RoadRunner"); + + return \ltrim($version, 'vV'); } /** |