Skip to content

Commit 117653c

Browse files
committed
Release build script
1 parent d5c5571 commit 117653c

8 files changed

Lines changed: 243 additions & 11 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,4 @@ nb-configuration.xml
131131

132132
/results/
133133
/phpunit*.xml
134+
File renamed without changes.

admin/docbot.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ GPG-signing key as appropriate.
2424

2525
Inside a shell prompt, in the project root:
2626

27-
`admin/docbot.sh [deploy]`
27+
`admin/docbot [deploy]`
2828

2929
If "deploy" is not added, the script execution is considered
3030
a trial run, and nothing is pushed to the repo.

admin/release

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
#~/bin/bash
2+
3+
## Build and deploy framework release
4+
5+
UPSTREAM=https://github.com/bcit-ci/CodeIgniter4.git
6+
action=test
7+
version=4
8+
qualifier=
9+
10+
branch=release-
11+
devonly='.github/* admin/* build/* contributing/* user_guide_src/* CODE_OF_CONDUCT.md \
12+
DCO.txt PULL_REQUEST_TEMPLATE.md'
13+
which=release
14+
15+
BOLD='\033[1m'
16+
NORMAL='\033[0m'
17+
COLOR='\033[1;31m'
18+
ERROR='\033[0;31m'
19+
20+
echo -e "${BOLD}${COLOR}CodeIgniter4 release builder${NORMAL}"
21+
echo '----------------------------'
22+
23+
#---------------------------------------------------
24+
# Check arguments
25+
echo -e "${BOLD}Checking arguments...${NORMAL}"
26+
27+
if [ $# -lt 1 ]; then
28+
echo "You really need to read the directions first!"
29+
exit 1
30+
fi
31+
32+
if [ $1 = 'deploy' ]; then
33+
action=deploy
34+
elif [ $1 != 'test' ]; then
35+
echo -e "${ERROR}Invalid action ($1)${NORMAL}"
36+
exit 1
37+
fi
38+
shift # drop the command from the argument list
39+
40+
version=$1
41+
if [ $# -gt 1 ]; then
42+
qualifier="-${2}"
43+
which='pre-release'
44+
fi
45+
branch="release-$version$qualifier"
46+
47+
#---------------------------------------------------
48+
# Create the release branch
49+
echo -e "${BOLD}Creating $which $branch to $action ${NORMAL}"
50+
51+
git checkout develop
52+
git branch -d $branch # remove the branch if there
53+
git checkout -b $branch
54+
55+
#---------------------------------------------------
56+
# Update version dependencies
57+
echo -e "${BOLD}Updating version dependencies${NORMAL}"
58+
59+
# CI_VERSION definition in system/CodeIgniter.php
60+
sed -i "/const CI_VERSION/s/'.*'/'${version}${qualifier}'/" system/CodeIgniter.php
61+
62+
# release substitution variable in user_guide_src/source/conf.py
63+
sed -i "/release =/s/'.*'/'${version}${qualifier}'/" user_guide_src/source/conf.py
64+
65+
# version & date in user_guide_src/source/changelog.rst
66+
sed -i "/|release|/s/|.*|/${version}${qualifier}/" user_guide_src/source/changelog.rst
67+
sed -i "/Release Date/s/Not Released/$(date +'%B %d, %Y')/" user_guide_src/source/changelog.rst
68+
69+
#---------------------------------------------------
70+
# Generate the user guide
71+
echo -e "${BOLD}Generate the user guide${NORMAL}"
72+
cd user_guide_src
73+
74+
# make the UG & embed it in the project root
75+
make html
76+
rm -Rf ../UserGuide
77+
mv build/html ../UserGuide
78+
79+
# make the epub & stick it in the project's "build" folder for now
80+
make epub
81+
mv build/epub/CodeIgniter4.epub "../build/CodeIgniter-UserGuide-${version}${qualifier}.epub"
82+
83+
cd ..
84+
85+
#---------------------------------------------------
86+
# Hide stuff from the release bundle
87+
echo -e "${BOLD}Hide stuff from the release bundle${NORMAL}"
88+
89+
# Restore the old .gitignore
90+
if [ -f admin/previous-gitignore ]; then
91+
cp -r admin/previous-gitignore .gitignore
92+
fi
93+
cp -r .gitignore admin/previous-gitignore
94+
95+
# Add the dev only folders/files to .gitignore
96+
for f in $devonly; do
97+
echo $f >> .gitignore
98+
done
99+
100+
#---------------------------------------------------
101+
# And finally, the release tag
102+
echo -e "${BOLD}Tag this branch for release${NORMAL}"
103+
git tag -a v${version}${qualifier} -m "Release ${version}${qualifier} build"
104+
105+
#---------------------------------------------------
106+
# Are we there yet?
107+
if [ $action = 'test' ]; then
108+
echo -e "${BOLD}Your $branch branch is ready to inspect.${NORMAL}"
109+
exit 0
110+
fi
111+
echo -e "${BOLD}Are we there yet (yes|no)?${NORMAL}"
112+
read answer
113+
if [ $answer != 'yes' ]; then
114+
echo -e "${BOLD}Your $branch branch is ready to inspect.${NORMAL}"
115+
echo "Rerun this script when ready to deploy"
116+
fi
117+
118+
#---------------------------------------------------
119+
# Merge away
120+
echo -e "${BOLD}Merge the release into master${NORMAL}"
121+
git checkout master
122+
git merge $branch
123+
git push UPSTREAM master
124+
125+
#---------------------------------------------------
126+
# Put our house back in order
127+
echo -e "${BOLD}Put our house back in order${NORMAL}"
128+
129+
mv -r admin/previous-gitignore .gitignore
130+
rm -Rf UserGuide
131+
rm -f build/*.epub
132+
133+
#---------------------------------------------------
134+
# Add next version block in changelog.rst
135+
echo -e "${BOLD}Setup next release${NORMAL}"
136+
sed -i '5 i\
137+
Version |release|
138+
====================================================
139+
140+
Release Date: Not Released
141+
' user_guide_src/source/changelog.rst
142+
143+
#---------------------------------------------------
144+
# Merge away
145+
echo -e "${BOLD}Setup the develop branch${NORMAL}"
146+
git add .
147+
git commit -S -m "Post ${branch} cleanup"
148+
git push origin master
149+
git push UPSTREAM master
150+
151+
git checkout develop
152+
git merge master
153+
git push origin develop
154+
git push UPSTREAM develop
155+
156+
git branch -d $branch
157+
158+
#---------------------------------------------------
159+
# Phew!
160+
161+
echo -e "${BOLD}Congratulations - we have liftoff${NORMAL}"
162+
echo "Don't forget to announce this release on the forum and on twitter!"

admin/release.md

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,81 @@
11
# release
22

3-
Builds & deploys framework release.
3+
Builds & deploys a framework release.
4+
5+
This tool is meant to help automate the process of
6+
launching a new release, by creating the release
7+
distribution files, tagging everything properly,
8+
and getting the repo branches in order.
9+
10+
## Audience
11+
12+
This script is intended for use by framework maintainers,
13+
i.e. someone with commit rights on the CI4 repository.
14+
15+
You will be prompted for your github credentials and
16+
GPG-signing key as appropriate.
17+
18+
## Workflow
19+
20+
The repo has two branches of interest: "master" (stable) and "develop" (in progress).
21+
There might be other feature branches, but they are not relevant to this process.
22+
23+
Once "develop" is ready for a new release, the general workflow is to
24+
25+
- create a release branch from develop
26+
- update version dependencies or constants
27+
- generate version(s) of the user guide
28+
- move or ignore stuff, distinguishing release from development
29+
- test that all is as it should be
30+
- tag and merge the release branch into "master"
31+
- merge "master" into "develop"
32+
- put everything back where it should be for development
33+
- remove the release branch
34+
35+
Visually:
36+
37+
develop -> release -> master -> develop
38+
39+
Finally, there are a couple of manual tasks:
40+
41+
- post a sticky announcement thread on the forum
42+
- tweet the release announcement
443

544
## Assumptions
645

46+
You (a maintainer) have forked the main CodeIgniter4 repo,
47+
and the git alias `origin`, in your local clone, refers to your fork.
48+
The script creates an additional alias, `upstream`, which refers to the
49+
main repo. This separation keeps the release branch isolated
50+
for any testing you want to do.
51+
52+
The `develop` branch of the main repo should be "clean", and ready for
53+
a release. This means that the changelog and upgrading instructions
54+
have been suitably edited.
55+
56+
This script is not intended to deal with hotfixes, i.e. PRs against
57+
`master` that need to also be merged into `develop`, probably
58+
as part of a bug fix minor release.
59+
760
## Usage
861

62+
Inside a shell prompt, in the project root:
63+
64+
`admin/release [test|deploy] version [qualifier]`
65+
66+
If the "deploy" action is not specified, the script execution is considered
67+
a trial run, and nothing is pushed to the repo.
68+
Whether or not deployed, the results are left inside
69+
the release branch in your local clone.
70+
71+
The "version" should follow semantic versioning, e.g. `4.0.6`, and the
72+
version number should be higher than the current released one.
73+
74+
The "qualifier" argument is a suffix to add to the version
75+
for a pre-release, e.g. `beta.2` or `rc.41`.
76+
77+
Examples:
78+
- `admin/release test 4.0.0 alpha.1` would prepare the "4.0.0-alpha.1" pre-release PR
79+
- `admin/release 4.0.0` would prepare the "4.0.0" release PR
80+
- `admin/release peanut butter banana` would complain and tell you to read these directions
81+

admin/release.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

user_guide_src/source/changelog.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
Change Log
33
##########
44

5-
Version |version|
5+
Version |release|
66
=================
77

8-
**Rewrite of the CodeIgniter framework**
9-
108
Release Date: Not Released
119

10+
**Rewrite of the CodeIgniter framework**
11+
1212
New core classes:
1313
- CodeIgniter (bootstrap)
1414
- Common (shared functions)

user_guide_src/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
# The short X.Y version.
5151
version = '4.0-dev'
5252
# The full version, including alpha/beta/rc tags.
53-
release = '4.0.0-not'
53+
release = '4.0.0-alpha.1'
5454

5555
# The language for content autogenerated by Sphinx. Refer to documentation
5656
# for a list of supported languages.
@@ -60,7 +60,7 @@
6060
# non-false value, then it is used:
6161
#today = ''
6262
# Else, today_fmt is used as the format for a strftime call.
63-
#today_fmt = '%B %d, %Y'
63+
today_fmt = '%B %d, %Y'
6464

6565
# List of patterns, relative to source directory, that match files and
6666
# directories to ignore when looking for source files.

0 commit comments

Comments
 (0)