Fallback to ANONADDY_VERSION env var if empty

This commit is contained in:
Will Browning 2022-08-01 09:16:36 +01:00
parent a605891cb2
commit 19ef4ad9c4
4 changed files with 39 additions and 30 deletions

View file

@ -60,6 +60,10 @@ class GitVersionHelper
chdir($dir); chdir($dir);
} }
if (! $output) {
return str(getenv('ANONADDY_VERSION', true));
}
return Str::of($output)->after('v')->trim(); return Str::of($output)->after('v')->trim();
} }
} }

View file

@ -9,13 +9,14 @@ class AppVersionController extends Controller
{ {
public function index() public function index()
{ {
$parts = str(Version::version())->explode('.'); $ver = Version::version();
$parts = $ver->explode('.');
return response()->json([ return response()->json([
'version' => Version::version(), 'version' => $ver,
'major' => (int) isset($parts[0]) ? $parts[0] : null, 'major' => isset($parts[0]) && $parts[0] !== '' ? (int) $parts[0] : 0,
'minor' => (int) isset($parts[1]) ? $parts[1] : null, 'minor' => isset($parts[1]) ? (int) $parts[1] : 0,
'patch' => (int) isset($parts[2]) ? $parts[2] : null, 'patch' => isset($parts[2]) ? (int) $parts[2] : 0,
]); ]);
} }
} }

42
composer.lock generated
View file

@ -1230,24 +1230,24 @@
}, },
{ {
"name": "graham-campbell/result-type", "name": "graham-campbell/result-type",
"version": "v1.0.4", "version": "v1.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/GrahamCampbell/Result-Type.git", "url": "https://github.com/GrahamCampbell/Result-Type.git",
"reference": "0690bde05318336c7221785f2a932467f98b64ca" "reference": "a878d45c1914464426dc94da61c9e1d36ae262a8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/0690bde05318336c7221785f2a932467f98b64ca", "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/a878d45c1914464426dc94da61c9e1d36ae262a8",
"reference": "0690bde05318336c7221785f2a932467f98b64ca", "reference": "a878d45c1914464426dc94da61c9e1d36ae262a8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.0 || ^8.0", "php": "^7.2.5 || ^8.0",
"phpoption/phpoption": "^1.8" "phpoption/phpoption": "^1.9"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" "phpunit/phpunit": "^8.5.28 || ^9.5.21"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -1276,7 +1276,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/GrahamCampbell/Result-Type/issues", "issues": "https://github.com/GrahamCampbell/Result-Type/issues",
"source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.0.4" "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.0"
}, },
"funding": [ "funding": [
{ {
@ -1288,7 +1288,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-11-21T21:41:47+00:00" "time": "2022-07-30T15:56:11+00:00"
}, },
{ {
"name": "guzzlehttp/guzzle", "name": "guzzlehttp/guzzle",
@ -3612,29 +3612,33 @@
}, },
{ {
"name": "phpoption/phpoption", "name": "phpoption/phpoption",
"version": "1.8.1", "version": "1.9.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/schmittjoh/php-option.git", "url": "https://github.com/schmittjoh/php-option.git",
"reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15" "reference": "dc5ff11e274a90cc1c743f66c9ad700ce50db9ab"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/schmittjoh/php-option/zipball/eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/dc5ff11e274a90cc1c743f66c9ad700ce50db9ab",
"reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", "reference": "dc5ff11e274a90cc1c743f66c9ad700ce50db9ab",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.0 || ^8.0" "php": "^7.2.5 || ^8.0"
}, },
"require-dev": { "require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1", "bamarni/composer-bin-plugin": "^1.8",
"phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" "phpunit/phpunit": "^8.5.28 || ^9.5.21"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": true
},
"branch-alias": { "branch-alias": {
"dev-master": "1.8-dev" "dev-master": "1.9-dev"
} }
}, },
"autoload": { "autoload": {
@ -3667,7 +3671,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/schmittjoh/php-option/issues", "issues": "https://github.com/schmittjoh/php-option/issues",
"source": "https://github.com/schmittjoh/php-option/tree/1.8.1" "source": "https://github.com/schmittjoh/php-option/tree/1.9.0"
}, },
"funding": [ "funding": [
{ {
@ -3679,7 +3683,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-12-04T23:24:31+00:00" "time": "2022-07-30T15:51:26+00:00"
}, },
{ {
"name": "pragmarx/google2fa", "name": "pragmarx/google2fa",

12
package-lock.json generated
View file

@ -1967,9 +1967,9 @@
"integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==" "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ=="
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "18.6.2", "version": "18.6.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.2.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.3.tgz",
"integrity": "sha512-KcfkBq9H4PI6Vpu5B/KoPeuVDAbmi+2mDBqGPGUgoL7yXQtcWGu2vJWmmRkneWK3Rh0nIAX192Aa87AqKHYChQ==" "integrity": "sha512-6qKpDtoaYLM+5+AFChLhHermMQxc3TOEFIDzrZLPRGHPrLEwqFkkT5Kx3ju05g6X7uDPazz3jHbKPX0KzCjntg=="
}, },
"node_modules/@types/parse-json": { "node_modules/@types/parse-json": {
"version": "4.0.0", "version": "4.0.0",
@ -10707,9 +10707,9 @@
"integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==" "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ=="
}, },
"@types/node": { "@types/node": {
"version": "18.6.2", "version": "18.6.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.2.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.3.tgz",
"integrity": "sha512-KcfkBq9H4PI6Vpu5B/KoPeuVDAbmi+2mDBqGPGUgoL7yXQtcWGu2vJWmmRkneWK3Rh0nIAX192Aa87AqKHYChQ==" "integrity": "sha512-6qKpDtoaYLM+5+AFChLhHermMQxc3TOEFIDzrZLPRGHPrLEwqFkkT5Kx3ju05g6X7uDPazz3jHbKPX0KzCjntg=="
}, },
"@types/parse-json": { "@types/parse-json": {
"version": "4.0.0", "version": "4.0.0",