diff --git a/admin/RELEASE.md b/admin/RELEASE.md index 98089ae8181f..731527de0ed7 100644 --- a/admin/RELEASE.md +++ b/admin/RELEASE.md @@ -2,7 +2,7 @@ > Documentation guide based on the releases of `4.0.5` and `4.1.0` on January 31, 2021. > -> Updated for `4.3.0` on January 10, 2023. +> Updated for `4.4.3` on October 27, 2023. > > -MGatner, kenjis @@ -53,12 +53,18 @@ Work off direct clones of the repos so the release branches persist for a time. * [ ] Clone both **codeigniter4/CodeIgniter4** and **codeigniter4/userguide** and resolve any necessary PRs ```console + rm -rf CodeIgniter4.bk userguide.bk + mv CodeIgniter4 CodeIgniter4.bk + mv userguide userguide.bk git clone git@github.com:codeigniter4/CodeIgniter4.git git clone git@github.com:codeigniter4/userguide.git ``` * [ ] Vet the **admin/** folders for any removed hidden files (Action deploy scripts *do not remove these*) - * git diff --name-status origin/master admin/ + ```console + cd CodeIgniter4 + git diff --name-status origin/master admin/ + ``` * [ ] Merge any Security Advisory PRs in private forks ## Process @@ -67,21 +73,24 @@ Work off direct clones of the repos so the release branches persist for a time. > been included with their PR, so this process assumes you will not be > generating much new content. -* [ ] Create a new branch `release-4.x.x` -* [ ] Update **system/CodeIgniter.php** with the new version number: - `const CI_VERSION = '4.x.x';` -* [ ] Update **user_guide_src/source/conf.py** with the new `version = '4.x'` (if applicable) - and `release = '4.x.x'` * [ ] Replace **CHANGELOG.md** with the new version generated above * [ ] Update **user_guide_src/source/changelogs/{version}.rst** - * Set the date to format `Release Date: January 31, 2021` * Remove the section titles that have no items * [ ] Update **user_guide_src/source/installation/upgrade_{ver}.rst** * fill in the "All Changes" section, and add it to **upgrading.rst** * git diff --name-status origin/master -- . ':!system' * Remove the section titles that have no items * [Minor version only] Update the "from" version in the title. E.g., `from 4.3.x` → `from 4.3.8` -* [ ] Commit the changes with `Prep for 4.x.x release` and push to origin +* [ ] Run `php admin/prepare-release.php 4.x.x` and push to origin + * The above command does the following: + * Create a new branch `release-4.x.x` + * Update **system/CodeIgniter.php** with the new version number: + `const CI_VERSION = '4.x.x';` + * Update **user_guide_src/source/conf.py** with the new `version = '4.x'` (if applicable) + and `release = '4.x.x'` + * Update **user_guide_src/source/changelogs/{version}.rst** + * Set the date to format `Release Date: January 31, 2021` + * Commit the changes with `Prep for 4.x.x release` * [ ] Create a new PR from `release-4.x.x` to `develop`: * Title: `Prep for 4.x.x release` * Description: @@ -119,6 +128,7 @@ Work off direct clones of the repos so the release branches persist for a time. * [ ] Run the following commands to install and test `appstarter` and verify the new version: ```console + rm -rf release-test composer create-project codeigniter4/appstarter release-test cd release-test composer test && composer info codeigniter4/framework @@ -152,7 +162,7 @@ Work off direct clones of the repos so the release branches persist for a time. git switch -c 4.x git push origin HEAD ``` -* [ ] Publish any Security Advisories that were resolved from private forks +* [ ] Request CVEs and Publish any Security Advisories that were resolved from private forks (note: publishing is restricted to administrators): * [ ] Announce the release on the forums and Slack channel (note: this forum is restricted to administrators): @@ -160,11 +170,13 @@ Work off direct clones of the repos so the release branches persist for a time. https://forum.codeigniter.com/forum-2.html * The content is somewhat organic, but should include any major features and changes as well as a link to the User Guide's changelog +* [ ] Run `php admin/create-new-changelog.php ` + * The above command does the following: + * Create **user_guide_src/source/changelogs/{next_version}.rst** and add it to + **index.rst** (See **next-changelog-*.rst**) + * Create **user_guide_src/source/installation/upgrade_{next_version}.rst** and add it to + **upgrading.rst** (See **next-upgrading-guide.rst**) * [ ] Create a PR for new changelog and upgrade for the next version - * Create **user_guide_src/source/changelogs/{next_version}.rst** and add it to - **index.rst** (See **next-changelog-*.rst**) - * Create **user_guide_src/source/installation/upgrade_{next_version}.rst** and add it to - **upgrading.rst** (See **next-upgrading-guide.rst**) ## Appendix diff --git a/admin/create-new-changelog.php b/admin/create-new-changelog.php new file mode 100644 index 000000000000..ff371345d166 --- /dev/null +++ b/admin/create-new-changelog.php @@ -0,0 +1,87 @@ + " . PHP_EOL; + echo "E.g.,: php {$argv[0]} 4.4.3 4.4.4" . PHP_EOL; + + exit(1); +} + +// Gets version number from argument. +$versionCurrent = $argv[1]; // e.g., '4.4.3' +$versionCurrentParts = explode('.', $versionCurrent); +$minorCurrent = $versionCurrentParts[0] . '.' . $versionCurrentParts[1]; +$version = $argv[2]; // e.g., '4.4.4' +$versionParts = explode('.', $version); +$minor = $versionParts[0] . '.' . $versionParts[1]; +$isMinorUpdate = ($minorCurrent !== $minor); + +// Creates a branch for release. +system('git switch develop'); +system('git switch -c docs-changelog-' . $version); +system('git switch docs-changelog-' . $version); + +// Copy changelog +$changelog = "./user_guide_src/source/changelogs/v{$version}.rst"; +$changelogIndex = './user_guide_src/source/changelogs/index.rst'; +if ($isMinorUpdate) { + copy('./admin/next-changelog-minor.rst', $changelog); +} else { + copy('./admin/next-changelog-patch.rst', $changelog); +} +// Add changelog to index.rst. +replace_file_content( + $changelogIndex, + '/\.\. toctree::\n :titlesonly:\n/u', + ".. toctree::\n :titlesonly:\n\n v{$version}" +); +// Replace {version} +$length = mb_strlen("Version {$version}"); +$underline = str_repeat('#', $length); +replace_file_content( + $changelog, + '/#################\nVersion {version}\n#################/u', + "{$underline}\nVersion {$version}\n{$underline}" +); +replace_file_content( + $changelog, + '/{version}/u', + "{$version}" +); + +// Copy upgrading +$versionWithoutDots = str_replace('.', '', $version); +$upgrading = "./user_guide_src/source/installation/upgrade_{$versionWithoutDots}.rst"; +$upgradingIndex = './user_guide_src/source/installation/upgrading.rst'; +copy('./admin/next-upgrading-guide.rst', $upgrading); +// Add upgrading to upgrading.rst. +replace_file_content( + $upgradingIndex, + '/ backward_compatibility_notes\n/u', + " backward_compatibility_notes\n\n upgrade_{$versionWithoutDots}" +); +// Replace {version} +$length = mb_strlen("Upgrading from {$versionCurrent} to {$version}"); +$underline = str_repeat('#', $length); +replace_file_content( + $upgrading, + '/##############################\nUpgrading from {version} to {version}\n##############################/u', + "{$underline}\nUpgrading from {$versionCurrent} to {$version}\n{$underline}" +); + +// Commits +system("git add {$changelog} {$changelogIndex}"); +system("git add {$upgrading} {$upgradingIndex}"); +system('git commit -m "docs: add changelog and upgrade for v' . $version . '"'); diff --git a/admin/next-changelog-minor.rst b/admin/next-changelog-minor.rst index f5bb20004d77..c22f0be7d9f3 100644 --- a/admin/next-changelog-minor.rst +++ b/admin/next-changelog-minor.rst @@ -1,3 +1,4 @@ +################# Version {version} ################# @@ -9,11 +10,13 @@ Release Date: Unreleased :local: :depth: 3 +********** Highlights ********** - TBD +******** BREAKING ******** @@ -26,6 +29,7 @@ Interface Changes Method Signature Changes ======================== +************ Enhancements ************ @@ -59,15 +63,19 @@ Helpers and Functions Others ====== +*************** Message Changes *************** +******* Changes ******* +************ Deprecations ************ +********** Bugs Fixed ********** diff --git a/admin/next-changelog-patch.rst b/admin/next-changelog-patch.rst index 4c76ca01a112..ed2ba70570b3 100644 --- a/admin/next-changelog-patch.rst +++ b/admin/next-changelog-patch.rst @@ -1,3 +1,4 @@ +################# Version {version} ################# @@ -9,18 +10,23 @@ Release Date: Unreleased :local: :depth: 3 +******** BREAKING ******** +*************** Message Changes *************** +******* Changes ******* +************ Deprecations ************ +********** Bugs Fixed ********** diff --git a/admin/next-upgrading-guide.rst b/admin/next-upgrading-guide.rst index fb97f320e95a..bcffc3fe3de5 100644 --- a/admin/next-upgrading-guide.rst +++ b/admin/next-upgrading-guide.rst @@ -12,15 +12,19 @@ Please refer to the upgrade instructions corresponding to your installation meth :local: :depth: 2 +********************** Mandatory File Changes ********************** +**************** Breaking Changes **************** +********************* Breaking Enhancements ********************* +************* Project Files ************* diff --git a/admin/prepare-release.php b/admin/prepare-release.php new file mode 100644 index 000000000000..1b173a0f75d6 --- /dev/null +++ b/admin/prepare-release.php @@ -0,0 +1,61 @@ +" . PHP_EOL; + echo "E.g.,: php {$argv[0]} 4.4.3" . PHP_EOL; + + exit(1); +} + +// Gets version number from argument. +$version = $argv[1]; // e.g., '4.4.3' +$versionParts = explode('.', $version); +$minor = $versionParts[0] . '.' . $versionParts[1]; + +// Creates a branch for release. +system('git switch develop'); +system('git switch -c release-' . $version); +system('git switch docs-changelog-' . $version); + +// Updates version number in "CodeIgniter.php". +replace_file_content( + './system/CodeIgniter.php', + '/public const CI_VERSION = \'.*?\';/u', + "public const CI_VERSION = '{$version}';" +); + +// Updates version number in "conf.py". +replace_file_content( + './user_guide_src/source/conf.py', + '/^version = \'.*?\'/mu', + "version = '{$minor}'" +); +replace_file_content( + './user_guide_src/source/conf.py', + '/^release = \'.*?\'/mu', + "release = '{$version}'" +); + +// Updates release date in changelogs. +$date = date('F j, Y'); +replace_file_content( + "./user_guide_src/source/changelogs/v{$version}.rst", + '/^Release Date: .*/mu', + "Release Date: {$date}" +); + +// Commits +system('git add -u'); +system('git commit -m "Prep for ' . $version . ' release"');