From 05777e7cd7df5b6a421189810d78140482b84d74 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Mon, 9 Sep 2024 14:16:46 -0700 Subject: [PATCH 1/2] Version never up to date --- src/SelfUpdateManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SelfUpdateManager.php b/src/SelfUpdateManager.php index 5bc5e73..d5c8f95 100644 --- a/src/SelfUpdateManager.php +++ b/src/SelfUpdateManager.php @@ -32,7 +32,7 @@ public function __construct(public string $applicationName, public string $curre */ public function isUpToDate(array $options = []): bool { $latestRelease = $this->getLatestReleaseFromGithub($options); - return NULL === $latestRelease || Comparator::greaterThanOrEqualTo($this->currentVersion, $latestRelease['version']); + return NULL === $latestRelease || Comparator::greaterThanOrEqualTo($this->currentVersion, $latestRelease['tag_name']); } /** From 737d600479faa795ca473a2b8f66c59086c9a551 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Mon, 9 Sep 2024 14:21:31 -0700 Subject: [PATCH 2/2] normalize version --- src/SelfUpdateManager.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SelfUpdateManager.php b/src/SelfUpdateManager.php index d5c8f95..ec4abe4 100644 --- a/src/SelfUpdateManager.php +++ b/src/SelfUpdateManager.php @@ -25,6 +25,7 @@ class SelfUpdateManager * which isn't available at this point in the Symfony bootstrap. */ public function __construct(public string $applicationName, public string $currentVersion, public string $gitHubRepository){ + $this->currentVersion = (new VersionParser())->normalize($this->currentVersion); } /** @@ -32,7 +33,7 @@ public function __construct(public string $applicationName, public string $curre */ public function isUpToDate(array $options = []): bool { $latestRelease = $this->getLatestReleaseFromGithub($options); - return NULL === $latestRelease || Comparator::greaterThanOrEqualTo($this->currentVersion, $latestRelease['tag_name']); + return NULL === $latestRelease || Comparator::greaterThanOrEqualTo($this->currentVersion, $latestRelease['version']); } /**