Skip to content

Commit 21acdff

Browse files
committed
First crack at updated admin scripts
1 parent 90f6f37 commit 21acdff

10 files changed

Lines changed: 168 additions & 157 deletions

File tree

admin/README.md

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

33
This folder contains tools or docs useful for project maintainers.
44

5-
##Repositories Organization, inside https://github.com/codeigniter4
5+
##Repositories inside https://github.com/codeigniter4
66

77
- **CodeIgniter4** is the main development repository.
88
It supports issues and pull requests, and has a rule to enforce GPG-signed commits.
@@ -45,6 +45,7 @@ This folder contains tools or docs useful for project maintainers.
4545

4646
##Maintainer Scripts
4747

48+
- **config** holds variables used for the maintainer & release building
4849
- **docbot** re-builds the user guide from the RST source for it,
4950
and optionally deploys it to the `gh-pages` branch of the main
5051
repository (if the user running it has maintainer rights on that repo).
@@ -59,7 +60,7 @@ scripts used by the release manager:
5960
This includes updating version dependencies or constants,
6061
generating version(s) of the user guide; and possibly
6162
moving or ignoring stuff, distinguishing release from development.
62-
If successful, it will leave a `releasing` file, with the version number
63+
If successful, it will update the `config` file, with the version number
6364
in it.
6465
- **release** builds release branches for the derived repositories
6566
(framework, appstarter and userguide).

admin/config

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
# Variables used for maintainers & release building
3+
4+
CI_ORG=https://github.com/codeigniter4/
5+
6+
BOLD='\033[1m'
7+
NORMAL='\033[0m'
8+
COLOR='\033[1;31m'
9+
ERROR='\033[0;31m'
10+
11+
# If RELEASE is set to something below, then we are part-way through the workflow
12+
RELEASE=

admin/docbot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Rebuild and deploy CodeIgniter4 user guide
44

5-
UPSTREAM=https://github.com/codeigniter4/CodeIgniter4.git
5+
. config
66

77
# Prepare the nested repo clone folder
88
cd user_guide_src

admin/post_release

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#!/bin/bash
2-
#######################DO NOT USE YET########################
32

43
## Cleanup after a framework release
54

6-
UPSTREAM=https://github.com/codeigniter4/CodeIgniter4.git
5+
UPSTREAM=${CI_ORG}CodeIgniter4.git
76
version=4
87
qualifier=
98

admin/pre-release

Lines changed: 51 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
#!/bin/bash
2-
#######################DO NOT USE YET########################
32

4-
## Build a framework release branch
3+
## Build framework release branch & distributables
54

65
#---------------------------------------------------
76
# Setup variables
87

9-
UPSTREAM=https://github.com/codeigniter4/CodeIgniter4.git
8+
. admin/config
9+
10+
#---------------------------------------------------
11+
# Sanity check - are we underway already?
12+
if [ -n "$RELEASE" ]; then
13+
echo -e "${BOLD}${ERROR}A release build is already underway${NORMAL}"
14+
exit 1
15+
fi
16+
1017
action=test
1118
version=4
1219
qualifier=
1320

1421
branch=release-
1522
releasable='application docs public system writable README.md composer.json contributing.md env license.txt spark'
16-
release_empty='tests tests/_support'
1723
which=release
1824

19-
BOLD='\033[1m'
20-
NORMAL='\033[0m'
21-
COLOR='\033[1;31m'
22-
ERROR='\033[0;31m'
23-
2425
echo -e "${BOLD}${COLOR}CodeIgniter4 release builder${NORMAL}"
2526
echo '----------------------------'
2627

@@ -29,7 +30,7 @@ echo '----------------------------'
2930
echo -e "${BOLD}Checking arguments...${NORMAL}"
3031

3132
if [ $# -lt 1 ]; then
32-
echo -e "${BOLD}Usage: admin/release version# pre-release-qualifier${NORMAL}"
33+
echo -e "${BOLD}Usage: admin/pre-release version# pre-release-qualifier${NORMAL}"
3334
exit 1
3435
fi
3536

@@ -39,7 +40,8 @@ if [ $# -gt 1 ]; then
3940
qualifier="-${2}"
4041
which='pre-release'
4142
fi
42-
branch="release-$version$qualifier"
43+
RELEASE=$version$qualifier
44+
branch="release-$RELEASE"
4345

4446
#---------------------------------------------------
4547
# Create the release branch
@@ -57,39 +59,51 @@ echo -e "${BOLD}Updating version dependencies${NORMAL}"
5759
function check_unique {
5860
count=`grep -c '$1' < $2 | wc -l`
5961
if [ $count -ne 1 ]; then
60-
echo -e "${BOLD}${COLOR}$2 has ${count} occurences of '$1'${NORMAL}"
62+
echo -e "${BOLD}${COLOR}$2 has ${count} occurrences of '$1'${NORMAL}"
6163
exit 1
6264
fi
6365
}
6466

6567
# Make sure there is only one line to affect in each file
6668
check_unique "const CI_VERSION" 'system/CodeIgniter.php'
6769
check_unique "release =" 'user_guide_src/source/conf.py'
68-
check_unique "|release|" 'user_guide_src/source/changelog.rst'
69-
check_unique "Release Date.*Not Released" 'user_guide_src/source/changelog.rst'
70+
check_unique "|release|" 'user_guide_src/source/changelogs/index.rst'
71+
check_unique "Release Date.*Not Released" 'user_guide_src/source/changelogs/index.rst'
7072

7173
# CI_VERSION definition in system/CodeIgniter.php
72-
sed -i "/const CI_VERSION/s/'.*'/'${version}${qualifier}'/" system/CodeIgniter.php
74+
sed -i "/const CI_VERSION/s/'.*'/'${RELEASE}'/" system/CodeIgniter.php
7375

7476
# release substitution variable in user_guide_src/source/conf.py
75-
sed -i "/release =/s/'.*'/'${version}${qualifier}'/" user_guide_src/source/conf.py
77+
sed -i "/release =/s/'.*'/'${RELEASE}'/" user_guide_src/source/conf.py
7678

7779
# version & date in user_guide_src/source/changelog.rst
78-
sed -i "/|release|/s/|.*|/${version}${qualifier}/" user_guide_src/source/changelog.rst
79-
sed -i "/Release Date/s/Not Released/$(date +'%B %d, %Y')/" user_guide_src/source/changelog.rst
80+
sed -i "/|release|/s/|.*|/${RELEASE}/" user_guide_src/source/changelogs/index.rst
81+
sed -i "/Release Date/s/Not Released/$(date +'%B %d, %Y')/" user_guide_src/source/changelogs/index.rst
82+
83+
# establish version-specific changelog
84+
mv user_guide_src/source/changelogs/next.rst user_guide_src/source/changelogs/${RELEASE}.rst
85+
# start new changelog for next version
8086

8187
#---------------------------------------------------
8288
# Setup the distribution folders
89+
echo -e "${BOLD}Building repo distributions${NORMAL}"
90+
91+
function setup_repo {
92+
mkdir dist/$1
93+
cd dist/$1
94+
git init
95+
git remote add origin ${CI_ORG}/$1
96+
git fetch
97+
}
8398

8499
if [ -d dist ]; then
85100
rm -rf dist/
86101
fi
87102
mkdir dist
88103

89-
if [ -d build ]; then
90-
rm -rf build/
91-
fi
92-
mkdir build
104+
setup_repo framework
105+
setup_repo docs
106+
setup_repo app-starter
93107

94108
#---------------------------------------------------
95109
# Generate the user guide
@@ -104,32 +118,34 @@ make epub
104118

105119
cd ..
106120

107-
mv user_guide_src/build/html build/docs
121+
cp -rf user_guide_src/build/html dist/docs
122+
mv user_guide_src/built/html dist/framework/docs
123+
124+
cd dist/docs
125+
git checkout gh-pages
126+
cp -r ../../docs .
108127

109128
#---------------------------------------------------
110129
# And finally, get ready for merging
111130
git add .
112-
git commit -m "Release ${version}${qualifier}"
131+
git commit -m "Release ${RELEASE}"
113132

114133
#---------------------------------------------------
115134
# Hide stuff from the release bundle
116135
echo -e "${BOLD}Build the distributables${NORMAL}"
117136

118-
for f in $releasable; do
119-
cp -r $f build/
120-
done
121-
for f in $release_empty; do
122-
mkdir build/$f
123-
done
124-
125137
# add the docs
126-
mv user_guide_src/build/epub/CodeIgniter4.epub dist/CodeIgniter-${version}${qualifier}.epub
138+
mv user_guide_src/build/epub/CodeIgniter4.epub dist/CodeIgniter-${BRANCH}.epub
127139

128140
cd build
129-
zip -r ../dist/v${version}${qualifier}.zip *
130-
tar -zcf ../dist/v${version}${qualifier}.tar.gz *
141+
zip -r ../dist/v${RELEASE}.zip *
142+
tar -zcf ../dist/v${RELEASE}.tar.gz *
143+
144+
#---------------------------------------------------
145+
# Save the in-progress branch designation for following steps
146+
sed -i "/RELEASE=/s/=.*/=${RELEASE}/" admin/config
131147

132148
#---------------------------------------------------
133149
# Done for now
134150
echo -e "${BOLD}Your $branch branch is ready to inspect.${NORMAL}"
135-
echo -e "${BOLD}Follow the directions in release.md to continue.${NORMAL}"
151+
echo -e "${BOLD}Follow the directions in workflow.md to continue.${NORMAL}"

admin/release

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
#!/bin/bash
2-
#######################DO NOT USE YET########################
32

43
## Build the distributable repo branches
54

5+
. admin/config
6+
7+
#---------------------------------------------------
8+
# Sanity check - are we underway already?
9+
if [ "$BRANCH" ]; then
10+
echo -e "${BOLD}${ERROR}No release build is underway${NORMAL}"
11+
exit 1
12+
fi
13+
14+
615
#---------------------------------------------------
716
# Setup variables
817

9-
UPSTREAM=https://github.comcodeigniter4/CodeIgniter4.git
18+
UPSTREAM=${CI_ORG}CodeIgniter4.git
1019
action=test
1120
version=4
1221
qualifier=

admin/workflow.md

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
# Workflow
22

3-
The repo has two branches of interest: "master" (stable) and "develop" (in progress).
3+
The main repo has two branches of interest: "master" (stable) and "develop" (in progress).
44
There might be other feature branches, but they are not relevant to this process.
55

66
Once "develop" is ready for a new release, the general workflow is to
77

8+
pre-release...
89
- create a "release" branch from develop
910
- update version dependencies or constants
1011
- generate version(s) of the user guide
1112
- move or ignore stuff, distinguishing release from development
1213
- test that all is as it should be
14+
15+
release...
1316
- merge the release branch into "master"
14-
- **manually** create the release & tag on github, based on master
15-
- put everything back where it should be for development
17+
- update the distribution repos
18+
- **manually** create the releases & tag them on github, based on master
19+
20+
post-release...
21+
- eliminate the build & dist folders used above
22+
- setup substitution variables for the next release
1623
- merge the post-release branch into "master"
1724
- merge the post-release branch into "develop"
1825
- **manually** delete the release branches in the repo
@@ -30,21 +37,13 @@ Visually:
3037
post-release -> master
3138
post->release -> develop
3239

33-
The `release` bash script does the first six workflow steps,
34-
and the `post-release` script does the other three between
35-
the manual steps.
36-
37-
For now, everything past the release branch build will be done
38-
manually, until the condidence level is high enough to
39-
automate some/all of those steps.
40-
4140
## Assumptions
4241

4342
You (a maintainer) have forked the main CodeIgniter4 repo,
4443
and the git alias `origin`, in your local clone, refers to your fork.
45-
The script creates an additional alias, `upstream`, which refers to the
46-
main repo. This separation keeps the release branch isolated
47-
for any testing you want to do.
44+
The `config` script defines an additional alias, `CI_ORG`, which refers to the
45+
CodeIgniter 4 organization on github.
46+
This separation keeps the release branch isolated for any testing you want to do.
4847

4948
The `develop` branch of the main repo should be "clean", and ready for
5049
a release. This means that the changelog and upgrading instructions
@@ -58,9 +57,9 @@ as part of a bug fix minor release.
5857

5958
Inside a shell prompt, in the project root:
6059

61-
`admin/release version [qualifier]`
60+
`admin/pre-release version [qualifier]`
6261

63-
Nothing is pushed to the repo. at this point -
62+
Nothing is pushed to the repo at this point -
6463
the results are left inside
6564
the release branch in your local clone.
6665

@@ -71,25 +70,27 @@ The "qualifier" argument is a suffix to add to the version
7170
for a pre-release, e.g. `beta.2` or `rc.41`.
7271

7372
Examples:
74-
- `admin/release 4.0.0 alpha.1` would prepare the "4.0.0-alpha.1" pre-release PR
75-
- `admin/release 4.0.0` would prepare the "4.0.0" release PR
76-
- `admin/release peanut butter banana` would complain and tell you to read these directions
73+
- `admin/pre-release 4.0.0 alpha.1` would prepare the "4.0.0-alpha.1" pre-release PR
74+
- `admin/pre-release 4.0.0` would prepare the "4.0.0" release PR
75+
- `admin/pre-release peanut butter banana` would complain and tell you to read these directions
76+
77+
Once you have vetted the `dist` folder inside your local repo, you
78+
can merge & push everything with
79+
80+
`admin/release`
7781

78-
Complete the next few steps of the release manually:
79-
- merge the release branch to "master"
80-
- push that to the main repo
81-
- on github.com, create an appropriate release (or pre-release)
82+
On github.com, create an appropriate release (or pre-release),
83+
with any optional files from the root of `dist`.
8284

83-
Once the release branch has been vetted, and you have
84-
completed the manual steps, clean up with:
85+
Once the github releases are done, clean up with:
8586

86-
`admin/post_release version [qualifier]`
87+
`admin/post_release`
8788

8889
## Release notes
8990

9091
On launch of a new release, a release notes post should be made in the
9192
announcements subforum. The planned text for it (so it can be previewed
92-
by admins) is in `admin/release_notes`.
93+
by admins) is in `admin/release_notes.bb`.
9394

9495
## Audience
9596

0 commit comments

Comments
 (0)