Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX Hardcode some module versions to installer version #12

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions consts.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,13 @@
'silverstripe-installer' => '5',
],
];

const INSTALLER_TO_REPO_MINOR_VERSIONS = [
'4.10' => [
GuySartorelli marked this conversation as resolved.
Show resolved Hide resolved
'html5' => '2.3',
'silverstripe-elemental-bannerblock' => '2.4',
'silverstripe-session-manager' => '1.2',
'silverstripe-userforms' => '5.12',
'silverstripe-totp-authenticator' => '4.3',
]
];
8 changes: 8 additions & 0 deletions job_creator.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ public function getInstallerVersion(): string
return $cmsMajor . '.' . $portions[1] . '.x-dev';
}
}
// hardcoded installer version for repo version
foreach (array_keys(INSTALLER_TO_REPO_MINOR_VERSIONS) as $installerVersion) {
foreach (INSTALLER_TO_REPO_MINOR_VERSIONS[$installerVersion] as $_repo => $repoVersion) {
if ($repo === $_repo && $repoVersion === $branch) {
return $installerVersion . '.x-dev';
}
}
}
// fallback to use the latest minor version of installer
$installerVersions = array_keys(INSTALLER_TO_PHP_VERSIONS);
$installerVersions = array_filter($installerVersions, fn($version) => substr($version, 0, 1) === $cmsMajor);
Expand Down
4 changes: 4 additions & 0 deletions tests/JobCreatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ public function provideGetInstallerVersion(): array
['myaccount/silverstripe-tagfield', 'pulls/burger/myfeature', $latest],
['myaccount/silverstripe-tagfield', '2-release', $latest],
['myaccount/silverstripe-tagfield', '2.9-release', $latest],
// hardcoded repo version
['myaccount/silverstripe-session-manager', '1', $latest],
['myaccount/silverstripe-session-manager', '1.2', '4.10.x-dev'],
['myaccount/silverstripe-session-manager', 'burger', $latest],
];
}

Expand Down