Fix getting version from temporary files in GH action
[MAILPOET-6097]
This commit is contained in:
@@ -5,6 +5,6 @@ require_once __DIR__ . '/helpers.php';
|
||||
$repository = 'woocommerce/automatewoo';
|
||||
$downloadCommand = 'download:automate-woo-zip';
|
||||
$configParameterName = 'automate_woo_version';
|
||||
$versionsFilename = 'automate_woo_versions.txt';
|
||||
$versionsFilenameSuffix = 'automate_woo_version.txt';
|
||||
|
||||
replacePrivatePluginVersion($repository, $downloadCommand, $configParameterName, $versionsFilename);
|
||||
replacePrivatePluginVersion($repository, $downloadCommand, $configParameterName, $versionsFilenameSuffix);
|
||||
|
@@ -5,6 +5,6 @@ require_once __DIR__ . '/helpers.php';
|
||||
$repository = 'woocommerce/woocommerce-memberships';
|
||||
$downloadCommand = 'download:woo-commerce-memberships-zip';
|
||||
$configParameterName = 'woo_memberships_version';
|
||||
$versionsFilename = 'woocommerce_memberships_versions.txt';
|
||||
$versionsFilenameSuffix = 'woocommerce_memberships_version.txt';
|
||||
|
||||
replacePrivatePluginVersion($repository, $downloadCommand, $configParameterName, $versionsFilename);
|
||||
replacePrivatePluginVersion($repository, $downloadCommand, $configParameterName, $versionsFilenameSuffix);
|
||||
|
@@ -5,6 +5,6 @@ require_once __DIR__ . '/helpers.php';
|
||||
$repository = 'woocommerce/woocommerce-subscriptions';
|
||||
$downloadCommand = 'download:woo-commerce-subscriptions-zip';
|
||||
$configParameterName = 'woo_subscriptions_version';
|
||||
$versionsFilename = 'woocommerce_subscriptions_versions.txt';
|
||||
$versionsFilenameSuffix = 'woocommerce_subscriptions_version.txt';
|
||||
|
||||
replacePrivatePluginVersion($repository, $downloadCommand, $configParameterName, $versionsFilename);
|
||||
replacePrivatePluginVersion($repository, $downloadCommand, $configParameterName, $versionsFilenameSuffix);
|
||||
|
@@ -4,7 +4,7 @@ require_once __DIR__ . '/helpers.php';
|
||||
|
||||
$downloadCommand = 'download:woo-commerce-zip';
|
||||
$configParameterName = 'woo_core_version';
|
||||
$versionsFilename = 'woocommerce_versions.txt';
|
||||
$versionsFilenameSuffix = 'woocommerce_version.txt';
|
||||
|
||||
/**
|
||||
* We get the official WooCommerce versions from the WordPress API.
|
||||
@@ -42,4 +42,4 @@ if ($previousVersion) {
|
||||
echo "No previous version found.\n";
|
||||
}
|
||||
|
||||
saveVersionsToFile($latestVersion, $previousVersion, $versionsFilename);
|
||||
saveVersionsToFiles($latestVersion, $previousVersion, $versionsFilenameSuffix);
|
||||
|
@@ -117,4 +117,4 @@ if ($previousVersion) {
|
||||
echo "No previous version found.\n";
|
||||
}
|
||||
|
||||
saveVersionsToFile($latestVersion, $previousVersion, 'wordpress_versions.txt');
|
||||
saveVersionsToFiles($latestVersion, $previousVersion, 'wordpress_version.txt');
|
||||
|
17
.github/workflows/scripts/helpers.php
vendored
17
.github/workflows/scripts/helpers.php
vendored
@@ -83,17 +83,12 @@ function fetchGitHubTags(string $repo, string $token): array {
|
||||
}
|
||||
|
||||
/**
|
||||
* Function saving versions to a temporary file.
|
||||
* Function saving versions to a temporary files.
|
||||
* File containing latest version is prefixed with 'latest_' and previous version is prefixed with 'previous_'.
|
||||
*/
|
||||
function saveVersionsToFile(string $latestVersion, string $previousVersion, string $fileName): void {
|
||||
$value = "";
|
||||
if ($latestVersion) {
|
||||
$value .= "- latest version: {$latestVersion}\n";
|
||||
}
|
||||
if ($previousVersion) {
|
||||
$value .= "- previous version: {$previousVersion}\n";
|
||||
}
|
||||
file_put_contents("/tmp/{$fileName}", $value);
|
||||
function saveVersionsToFiles(string $latestVersion, string $previousVersion, string $fileNameSuffix): void {
|
||||
file_put_contents("/tmp/latest_{$fileNameSuffix}", $latestVersion);
|
||||
file_put_contents("/tmp/previous_{$fileNameSuffix}", $previousVersion);
|
||||
}
|
||||
|
||||
function replaceLatestVersion(string $latestVersion, string $downloadCommand): void {
|
||||
@@ -150,5 +145,5 @@ function replacePrivatePluginVersion(
|
||||
echo "No previous version found.\n";
|
||||
}
|
||||
|
||||
saveVersionsToFile($latestVersion, $previousVersion, $versionsFilename);
|
||||
saveVersionsToFiles($latestVersion, $previousVersion, $versionsFilename);
|
||||
}
|
||||
|
Reference in New Issue
Block a user