Skip to content

Commit 4a0197e

Browse files
authored
Merge pull request #8100 from kenjis/docs-update-RELEASE.md
docs: update RELEASE.md
2 parents 94e13a4 + ea2b26b commit 4a0197e

File tree

6 files changed

+192
-14
lines changed

6 files changed

+192
-14
lines changed

admin/RELEASE.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> Documentation guide based on the releases of `4.0.5` and `4.1.0` on January 31, 2021.
44
>
5-
> Updated for `4.3.0` on January 10, 2023.
5+
> Updated for `4.4.3` on October 27, 2023.
66
>
77
> -MGatner, kenjis
88
@@ -53,12 +53,18 @@ Work off direct clones of the repos so the release branches persist for a time.
5353
* [ ] Clone both **codeigniter4/CodeIgniter4** and **codeigniter4/userguide** and
5454
resolve any necessary PRs
5555
```console
56+
rm -rf CodeIgniter4.bk userguide.bk
57+
mv CodeIgniter4 CodeIgniter4.bk
58+
mv userguide userguide.bk
5659
git clone [email protected]:codeigniter4/CodeIgniter4.git
5760
git clone [email protected]:codeigniter4/userguide.git
5861
```
5962
* [ ] Vet the **admin/** folders for any removed hidden files (Action deploy scripts
6063
*do not remove these*)
61-
* git diff --name-status origin/master admin/
64+
```console
65+
cd CodeIgniter4
66+
git diff --name-status origin/master admin/
67+
```
6268
* [ ] Merge any Security Advisory PRs in private forks
6369

6470
## Process
@@ -67,21 +73,24 @@ Work off direct clones of the repos so the release branches persist for a time.
6773
> been included with their PR, so this process assumes you will not be
6874
> generating much new content.
6975
70-
* [ ] Create a new branch `release-4.x.x`
71-
* [ ] Update **system/CodeIgniter.php** with the new version number:
72-
`const CI_VERSION = '4.x.x';`
73-
* [ ] Update **user_guide_src/source/conf.py** with the new `version = '4.x'` (if applicable)
74-
and `release = '4.x.x'`
7576
* [ ] Replace **CHANGELOG.md** with the new version generated above
7677
* [ ] Update **user_guide_src/source/changelogs/{version}.rst**
77-
* Set the date to format `Release Date: January 31, 2021`
7878
* Remove the section titles that have no items
7979
* [ ] Update **user_guide_src/source/installation/upgrade_{ver}.rst**
8080
* fill in the "All Changes" section, and add it to **upgrading.rst**
8181
* git diff --name-status origin/master -- . ':!system'
8282
* Remove the section titles that have no items
8383
* [Minor version only] Update the "from" version in the title. E.g., `from 4.3.x``from 4.3.8`
84-
* [ ] Commit the changes with `Prep for 4.x.x release` and push to origin
84+
* [ ] Run `php admin/prepare-release.php 4.x.x` and push to origin
85+
* The above command does the following:
86+
* Create a new branch `release-4.x.x`
87+
* Update **system/CodeIgniter.php** with the new version number:
88+
`const CI_VERSION = '4.x.x';`
89+
* Update **user_guide_src/source/conf.py** with the new `version = '4.x'` (if applicable)
90+
and `release = '4.x.x'`
91+
* Update **user_guide_src/source/changelogs/{version}.rst**
92+
* Set the date to format `Release Date: January 31, 2021`
93+
* Commit the changes with `Prep for 4.x.x release`
8594
* [ ] Create a new PR from `release-4.x.x` to `develop`:
8695
* Title: `Prep for 4.x.x release`
8796
* Description:
@@ -119,6 +128,7 @@ Work off direct clones of the repos so the release branches persist for a time.
119128
* [ ] Run the following commands to install and test `appstarter` and verify the new
120129
version:
121130
```console
131+
rm -rf release-test
122132
composer create-project codeigniter4/appstarter release-test
123133
cd release-test
124134
composer test && composer info codeigniter4/framework
@@ -152,19 +162,21 @@ Work off direct clones of the repos so the release branches persist for a time.
152162
git switch -c 4.x
153163
git push origin HEAD
154164
```
155-
* [ ] Publish any Security Advisories that were resolved from private forks
165+
* [ ] Request CVEs and Publish any Security Advisories that were resolved from private forks
156166
(note: publishing is restricted to administrators):
157167
* [ ] Announce the release on the forums and Slack channel
158168
(note: this forum is restricted to administrators):
159169
* Make a new topic in the "News & Discussion" forums:
160170
https://forum.codeigniter.com/forum-2.html
161171
* The content is somewhat organic, but should include any major features and
162172
changes as well as a link to the User Guide's changelog
173+
* [ ] Run `php admin/create-new-changelog.php <current_version> <new_version>`
174+
* The above command does the following:
175+
* Create **user_guide_src/source/changelogs/{next_version}.rst** and add it to
176+
**index.rst** (See **next-changelog-*.rst**)
177+
* Create **user_guide_src/source/installation/upgrade_{next_version}.rst** and add it to
178+
**upgrading.rst** (See **next-upgrading-guide.rst**)
163179
* [ ] Create a PR for new changelog and upgrade for the next version
164-
* Create **user_guide_src/source/changelogs/{next_version}.rst** and add it to
165-
**index.rst** (See **next-changelog-*.rst**)
166-
* Create **user_guide_src/source/installation/upgrade_{next_version}.rst** and add it to
167-
**upgrading.rst** (See **next-upgrading-guide.rst**)
168180
169181
## Appendix
170182

admin/create-new-changelog.php

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
function replace_file_content(string $path, string $pattern, string $replace): void
6+
{
7+
$file = file_get_contents($path);
8+
$output = preg_replace($pattern, $replace, $file);
9+
file_put_contents($path, $output);
10+
}
11+
12+
// Main.
13+
chdir(__DIR__ . '/..');
14+
15+
if ($argc !== 3) {
16+
echo "Usage: php {$argv[0]} <current_version> <new_version>" . PHP_EOL;
17+
echo "E.g.,: php {$argv[0]} 4.4.3 4.4.4" . PHP_EOL;
18+
19+
exit(1);
20+
}
21+
22+
// Gets version number from argument.
23+
$versionCurrent = $argv[1]; // e.g., '4.4.3'
24+
$versionCurrentParts = explode('.', $versionCurrent);
25+
$minorCurrent = $versionCurrentParts[0] . '.' . $versionCurrentParts[1];
26+
$version = $argv[2]; // e.g., '4.4.4'
27+
$versionParts = explode('.', $version);
28+
$minor = $versionParts[0] . '.' . $versionParts[1];
29+
$isMinorUpdate = ($minorCurrent !== $minor);
30+
31+
// Creates a branch for release.
32+
system('git switch develop');
33+
system('git switch -c docs-changelog-' . $version);
34+
system('git switch docs-changelog-' . $version);
35+
36+
// Copy changelog
37+
$changelog = "./user_guide_src/source/changelogs/v{$version}.rst";
38+
$changelogIndex = './user_guide_src/source/changelogs/index.rst';
39+
if ($isMinorUpdate) {
40+
copy('./admin/next-changelog-minor.rst', $changelog);
41+
} else {
42+
copy('./admin/next-changelog-patch.rst', $changelog);
43+
}
44+
// Add changelog to index.rst.
45+
replace_file_content(
46+
$changelogIndex,
47+
'/\.\. toctree::\n :titlesonly:\n/u',
48+
".. toctree::\n :titlesonly:\n\n v{$version}"
49+
);
50+
// Replace {version}
51+
$length = mb_strlen("Version {$version}");
52+
$underline = str_repeat('#', $length);
53+
replace_file_content(
54+
$changelog,
55+
'/#################\nVersion {version}\n#################/u',
56+
"{$underline}\nVersion {$version}\n{$underline}"
57+
);
58+
replace_file_content(
59+
$changelog,
60+
'/{version}/u',
61+
"{$version}"
62+
);
63+
64+
// Copy upgrading
65+
$versionWithoutDots = str_replace('.', '', $version);
66+
$upgrading = "./user_guide_src/source/installation/upgrade_{$versionWithoutDots}.rst";
67+
$upgradingIndex = './user_guide_src/source/installation/upgrading.rst';
68+
copy('./admin/next-upgrading-guide.rst', $upgrading);
69+
// Add upgrading to upgrading.rst.
70+
replace_file_content(
71+
$upgradingIndex,
72+
'/ backward_compatibility_notes\n/u',
73+
" backward_compatibility_notes\n\n upgrade_{$versionWithoutDots}"
74+
);
75+
// Replace {version}
76+
$length = mb_strlen("Upgrading from {$versionCurrent} to {$version}");
77+
$underline = str_repeat('#', $length);
78+
replace_file_content(
79+
$upgrading,
80+
'/##############################\nUpgrading from {version} to {version}\n##############################/u',
81+
"{$underline}\nUpgrading from {$versionCurrent} to {$version}\n{$underline}"
82+
);
83+
84+
// Commits
85+
system("git add {$changelog} {$changelogIndex}");
86+
system("git add {$upgrading} {$upgradingIndex}");
87+
system('git commit -m "docs: add changelog and upgrade for v' . $version . '"');

admin/next-changelog-minor.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#################
12
Version {version}
23
#################
34

@@ -9,11 +10,13 @@ Release Date: Unreleased
910
:local:
1011
:depth: 3
1112

13+
**********
1214
Highlights
1315
**********
1416

1517
- TBD
1618

19+
********
1720
BREAKING
1821
********
1922

@@ -26,6 +29,7 @@ Interface Changes
2629
Method Signature Changes
2730
========================
2831

32+
************
2933
Enhancements
3034
************
3135

@@ -59,15 +63,19 @@ Helpers and Functions
5963
Others
6064
======
6165

66+
***************
6267
Message Changes
6368
***************
6469

70+
*******
6571
Changes
6672
*******
6773

74+
************
6875
Deprecations
6976
************
7077

78+
**********
7179
Bugs Fixed
7280
**********
7381

admin/next-changelog-patch.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#################
12
Version {version}
23
#################
34

@@ -9,18 +10,23 @@ Release Date: Unreleased
910
:local:
1011
:depth: 3
1112

13+
********
1214
BREAKING
1315
********
1416

17+
***************
1518
Message Changes
1619
***************
1720

21+
*******
1822
Changes
1923
*******
2024

25+
************
2126
Deprecations
2227
************
2328

29+
**********
2430
Bugs Fixed
2531
**********
2632

admin/next-upgrading-guide.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@ Please refer to the upgrade instructions corresponding to your installation meth
1212
:local:
1313
:depth: 2
1414

15+
**********************
1516
Mandatory File Changes
1617
**********************
1718

19+
****************
1820
Breaking Changes
1921
****************
2022

23+
*********************
2124
Breaking Enhancements
2225
*********************
2326

27+
*************
2428
Project Files
2529
*************
2630

admin/prepare-release.php

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
function replace_file_content(string $path, string $pattern, string $replace): void
6+
{
7+
$file = file_get_contents($path);
8+
$output = preg_replace($pattern, $replace, $file);
9+
file_put_contents($path, $output);
10+
}
11+
12+
// Main.
13+
chdir(__DIR__ . '/..');
14+
15+
if ($argc !== 2) {
16+
echo "Usage: php {$argv[0]} <version>" . PHP_EOL;
17+
echo "E.g.,: php {$argv[0]} 4.4.3" . PHP_EOL;
18+
19+
exit(1);
20+
}
21+
22+
// Gets version number from argument.
23+
$version = $argv[1]; // e.g., '4.4.3'
24+
$versionParts = explode('.', $version);
25+
$minor = $versionParts[0] . '.' . $versionParts[1];
26+
27+
// Creates a branch for release.
28+
system('git switch develop');
29+
system('git switch -c release-' . $version);
30+
system('git switch docs-changelog-' . $version);
31+
32+
// Updates version number in "CodeIgniter.php".
33+
replace_file_content(
34+
'./system/CodeIgniter.php',
35+
'/public const CI_VERSION = \'.*?\';/u',
36+
"public const CI_VERSION = '{$version}';"
37+
);
38+
39+
// Updates version number in "conf.py".
40+
replace_file_content(
41+
'./user_guide_src/source/conf.py',
42+
'/^version = \'.*?\'/mu',
43+
"version = '{$minor}'"
44+
);
45+
replace_file_content(
46+
'./user_guide_src/source/conf.py',
47+
'/^release = \'.*?\'/mu',
48+
"release = '{$version}'"
49+
);
50+
51+
// Updates release date in changelogs.
52+
$date = date('F j, Y');
53+
replace_file_content(
54+
"./user_guide_src/source/changelogs/v{$version}.rst",
55+
'/^Release Date: .*/mu',
56+
"Release Date: {$date}"
57+
);
58+
59+
// Commits
60+
system('git add -u');
61+
system('git commit -m "Prep for ' . $version . ' release"');

0 commit comments

Comments
 (0)