Deploy: Use the requirement rather than the tested version (#5235)

This commit is contained in:
Ben Dwyer 2021-12-20 15:18:46 +00:00 committed by GitHub
parent 2ef8a95e1f
commit 68715b8323
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -191,7 +191,7 @@ async function buildComZip(themeSlug) {
// Gets the theme version (Version:) and minimum WP version (Tested up to:) from the theme's style.css
let themeVersion = getThemeMetadata(styleCss, 'Version');
let wpVersionCompat = getThemeMetadata(styleCss, 'Tested up to');
let wpVersionCompat = getThemeMetadata(styleCss, 'Requires at least');
if (themeVersion && wpVersionCompat) {
await executeOnSandbox(`php ${sandboxRootFolder}bin/themes/theme-downloads/build-theme-zip.php --stylesheet=pub/${themeSlug} --themeversion=${themeVersion} --wpversioncompat=${wpVersionCompat}`, true);
@ -379,9 +379,9 @@ function getThemeMetadata(styleCss, attribute) {
.match(/(?<=Version:\s*).*?(?=\s*\r?\n|\rg)/gs)[0]
.trim()
.replace('-wpcom', '');
case 'Tested up to':
case 'Requires at least':
return styleCss
.match(/(?<=Tested up to:\s*).*?(?=\s*\r?\n|\rg)/gs);
.match(/(?<=Requires at least:\s*).*?(?=\s*\r?\n|\rg)/gs);
}
}
@ -838,4 +838,3 @@ async function executeCommand(command, logResponse) {
});
});
}