Skip to content

Commit d97aa5f

Browse files
authored
Merge pull request #1030 from kenjis/release-1.0.1
Prep for 1.0.1 release
2 parents f930da1 + cf60d27 commit d97aa5f

File tree

5 files changed

+63
-33
lines changed

5 files changed

+63
-33
lines changed

.github/prlint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"title": [
33
{
4-
"pattern": "^(\\[\\d+\\.\\d+\\]\\s{1})?(feat|fix|chore|docs|perf|refactor|style|test|lang)(\\([\\-.@:`a-zA-Z0-9]+\\))?!?:\\s{1}\\S.+\\S$",
4+
"pattern": "^(\\[\\d+\\.\\d+\\]\\s{1})?(feat|fix|chore|docs|perf|refactor|style|test|lang)(\\([\\-.@:`a-zA-Z0-9]+\\))?!?:\\s{1}\\S.+\\S|Prep for \\d\\.\\d\\.\\d release$",
55
"message": "PR title must include the type (feat, fix, chore, docs, perf, refactor, style, test, lang) of the commit per Conventional Commits specification. See https://www.conventionalcommits.org/en/v1.0.0/ for the discussion."
66
}
77
]

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: docs
22
on:
33
push:
44
branches:
5-
- master
5+
- develop
66
permissions:
77
contents: write
88
jobs:

admin/RELEASE.md

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
> Documentation guide based on the releases of `1.0.0-beta.5` on March 17, 2023.
44
>
5+
> Updated for `1.0.1` on February 15, 2024.
6+
> Starting with this version, we have stopped using the `master` branch.
7+
>
58
> -kenjis
69
710
## Changelog
@@ -25,8 +28,8 @@ To auto-generate, navigate to the
2528
[Releases](https://github.com/codeigniter4/shield/releases) page,
2629
click the "Draft a new release" button.
2730

28-
* Tag: "v1.0.0-beta.5" (Create new tag)
29-
* Target: develop
31+
* Tag: `v1.x.x` (Create new tag)
32+
* Target: `develop`
3033

3134
Click the "Generate release notes" button.
3235

@@ -50,42 +53,29 @@ the changelog.
5053
> been included with their PR, so this process assumes you will not be
5154
> generating much new content.
5255

53-
* [ ] Create a new branch `release-1.x.x`
54-
* [ ] Update **src/Auth.php** with the new version number:
55-
`const SHIELD_VERSION = '1.x.x';`
56-
* [ ] Commit the changes with "Prep for 1.x.x release" and push to origin
56+
* [ ] Run `php admin/prepare-release.php 1.x.x` and push to origin
57+
* The above command does the following:
58+
* Create a new branch `release-1.x.x`
59+
* Update **src/Auth.php** with the new version number:
60+
`const SHIELD_VERSION = '1.x.x';`
61+
* Commit the changes with "Prep for 1.x.x release" and push to origin
5762
* [ ] Create a new PR from `release-1.x.x` to `develop`:
58-
* Title: "Prep for 1.x.x release"
59-
* Description: "Updates version references for `1.x.x`." (plus checklist)
63+
* Title: `Prep for 1.x.x release`
64+
* Description: `Updates version references for 1.x.x.` (plus checklist)
6065
* [ ] Let all tests run, then review and merge the PR
61-
* [ ] Create a new PR from `develop` to `master`:
62-
* Title: "1.x.x Ready code"
63-
* Description: blank
6466
* [ ] Merge the PR
6567
* [ ] Create a new Release:
66-
* Version: "v1.x.x"
67-
* Target: master
68-
* Title: "v1.x.x"
68+
* Version: `v1.x.x`
69+
* Target: `develop`
70+
* Title: `v1.x.x`
6971
* Click the "Generate release notes" button
70-
* Remove "### Others (Only for checking. Remove this category)" section
71-
* Add important notes if necessary
72-
* Add link to Upgrade Guide if necessary
73-
* Check "Create a discussion for this release"
72+
* [ ] Remove "### Others (Only for checking. Remove this category)" section
73+
* [ ] Add important notes if necessary
74+
* [ ] Add link to Upgrade Guide if necessary
75+
* [ ] Check "Create a discussion for this release"
7476
* Click the "Publish release" button
7577
* [ ] Watch for the "docs" action and verify that the user guide updated:
7678
* [docs](https://github.com/codeigniter4/shield/actions/workflows/docs.yml)
77-
* [ ] Fast-forward `develop` branch to catch the merge commit from `master`
78-
(note: pushing to `develop` is restricted to administrators):
79-
```console
80-
git fetch origin
81-
git checkout develop
82-
git merge origin/develop
83-
git merge origin/master
84-
git push origin HEAD # Only administrators can push to the protected branch.
85-
```
86-
**At this point, `master` must be merged into `develop`.** Otherwise, the
87-
GitHub-generated release note from `develop` for the next release will not be
88-
generated correctly.
8979
* [ ] Publish any Security Advisories that were resolved from private forks
9080
(note: publishing is restricted to administrators)
9181
* [ ] Announce the release on the forums and Slack channel

admin/prepare-release.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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]} 1.0.1" . 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+
31+
// Updates version number in "src/Auth.php".
32+
replace_file_content(
33+
'./src/Auth.php',
34+
'/const SHIELD_VERSION = \'.*?\';/u',
35+
"const SHIELD_VERSION = '{$version}';"
36+
);
37+
38+
// Commits
39+
system('git add -u');
40+
system('git commit -m "Prep for ' . $version . ' release"');

src/Auth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Auth
4141
/**
4242
* The current version of CodeIgniter Shield
4343
*/
44-
public const SHIELD_VERSION = '1.0.0';
44+
public const SHIELD_VERSION = '1.0.1';
4545

4646
protected AuthConfig $config;
4747
protected ?Authentication $authenticate = null;

0 commit comments

Comments
 (0)