diff --git a/job_creator.php b/job_creator.php index 433fae9..2620e15 100644 --- a/job_creator.php +++ b/job_creator.php @@ -477,8 +477,8 @@ public function createJson(string $yml): string $inputs = $this->getInputs($yml); // $myRef will either be a branch for push (i.e cron) and pull-request (target branch), or a semver tag $myRef = $inputs['github_my_ref']; - $isTag = preg_match('#^([0-9]+)\.([0-9]+)\.[0-9]+$#', $myRef, $m) - || preg_match('#^([0-9]+)\.([0-9]+)\.[0-9]+-(alpha|beta|rc)[0-9]+$#', $myRef, $m); + $unstableTagRx = '#^([0-9]+)\.([0-9]+)\.[0-9]+-((alpha|beta|rc))[0-9]+$#'; + $isTag = preg_match('#^([0-9]+)\.([0-9]+)\.[0-9]+$#', $myRef, $m) || preg_match($unstableTagRx, $myRef, $m); $this->branch = $isTag ? sprintf('%d.%d', $m[1], $m[2]) : $myRef; // parent branch is a best attempt to get the parent branch of the branch via bash @@ -489,6 +489,9 @@ public function createJson(string $yml): string $this->githubRepository = $inputs['github_repository']; $this->installerVersion = $this->getInstallerVersion(); + if (preg_match($unstableTagRx, $myRef, $m)) { + $this->installerVersion = str_replace('.x-dev', '.0-' . $m[3] . '1', $this->installerVersion); + } $run = []; $extraJobs = []; diff --git a/tests/JobCreatorTest.php b/tests/JobCreatorTest.php index 00ae69c..e4c4247 100644 --- a/tests/JobCreatorTest.php +++ b/tests/JobCreatorTest.php @@ -576,7 +576,7 @@ public function provideGitHubMyRefTags(): array return [ ['4.10', '4.10.x-dev'], ['4.10.6', '4.10.x-dev'], - ['5.0.0-beta1', '5.0.x-dev'], + ['5.0.0-beta2', '5.0.0-beta1'], ]; }