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

Internal: Update monorepo release script #1276

Merged
merged 6 commits into from
Mar 14, 2023
Merged
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
25 changes: 17 additions & 8 deletions monorepo/release.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@

echo "Version: $version\n";

echo "Updating Hyde composer.json...\n";
//echo "Updating Hyde composer.json...\n";

// get just the minor number
$shortVersion = substr($version, 3);
//$shortVersion = substr($version, 3);
// trim everything after the first dot
$shortVersion = substr($shortVersion, 0, strpos($shortVersion, '.'));
//$shortVersion = substr($shortVersion, 0, strpos($shortVersion, '.'));

echo "Short version: $shortVersion\n";
$composerJson = json_decode(file_get_contents(__DIR__.'/../packages/hyde/composer.json'), true);
$composerJson['require']['hyde/framework'] = "^0.$shortVersion";
file_put_contents(__DIR__.'/../packages/hyde/composer.json', json_encode($composerJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
//echo "Short version: $shortVersion\n";
//$composerJson = json_decode(file_get_contents(__DIR__.'/../packages/hyde/composer.json'), true);
//$composerJson['require']['hyde/framework'] = "^0.$shortVersion";
//file_put_contents(__DIR__.'/../packages/hyde/composer.json', json_encode($composerJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));

echo "Transforming upcoming release notes... \n";

Expand All @@ -57,7 +57,7 @@
];

foreach ($defaults as $default) {
$notes = str_replace($default, '', $notes);
$notes = str_replace($default, 'DEFAULT', $notes);
}

$notes = str_replace('Keep an Unreleased section at the top to track upcoming changes.
Expand All @@ -73,6 +73,15 @@
$notes = str_replace('YYYY-MM-DD', date('Y-m-d'), $notes);
$notes = $notes."\n";

// remove empty sections
$notes = preg_replace('/### (Added|Changed|Deprecated|Removed|Fixed|Security)\nDEFAULT/', '', $notes);

// remove ### About if it's empty
$notes = str_replace("### About\n\n\n", "\n", $notes);

// remove empty lines
$notes = preg_replace('/\n{3,}/', "\n", $notes);

echo "Done. \n";

echo 'Resetting upcoming release notes stub';
Expand Down