forked from bcit-ci/CodeIgniter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci skip] Add a bash script to help with releases
- Loading branch information
Showing
1 changed file
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd $(dirname $BASH_SOURCE) | ||
|
||
if [ $# -eq 0 ]; then | ||
echo 'Usage: '$BASH_SOURCE' <version_number>' | ||
exit 1 | ||
fi | ||
|
||
version_number=$1 | ||
|
||
if [ ${#version_number} -lt 5 ] | ||
then | ||
echo "Provided version number is too short" | ||
exit 1 | ||
elif [ ${version_number: -4} == "-dev" ] | ||
then | ||
echo "'-dev' releases are not allowed" | ||
exit 1 | ||
fi | ||
|
||
version_id=${version_number:0:5} | ||
version_id=${version_id//./} | ||
upgrade_rst='user_guide_src/source/installation/upgrade_'$version_id'.rst' | ||
|
||
if [ ${#version_id} -ne 3 ] | ||
then | ||
echo "Invalid version number format" | ||
exit 1 | ||
elif [ `grep -c -F --regexp="'$version_number'" system/core/CodeIgniter.php` -ne 1 ] | ||
then | ||
echo "Provided version number doesn't match in system/core/CodeIgniter.php" | ||
exit 1 | ||
elif [ `grep -c -F --regexp="'$version_number'" user_guide_src/source/conf.py` -ne 2 ] | ||
then | ||
echo "Provided version number doesn't match in user_guide_src/source/conf.py" | ||
exit 1 | ||
elif [ ! -f "$upgrade_rst" ] | ||
then | ||
echo "${upgrade_rst} doesn't exist" | ||
exit 1 | ||
fi | ||
|
||
echo "Running tests ..." | ||
|
||
cd tests/ | ||
phpunit | ||
|
||
if [ $? -ne 0 ] | ||
then | ||
echo "Build FAILED!" | ||
exit 1 | ||
fi | ||
|
||
cd .. | ||
cd user_guide_src/ | ||
|
||
echo "" | ||
echo "Building HTML docs; please check output for warnings ..." | ||
echo "" | ||
|
||
make html | ||
|
||
echo "" | ||
|
||
if [ $? -ne 0 ] | ||
then | ||
echo "Build FAILED!" | ||
exit 1 | ||
fi | ||
|
||
echo "Building EPUB docs; please check output for warnings ..." | ||
echo "" | ||
|
||
make epub | ||
|
||
echo "" | ||
|
||
if [ $? -ne 0 ] | ||
then | ||
echo "Build FAILED!" | ||
exit 1 | ||
fi | ||
|
||
cd .. | ||
|
||
if [ -d user_guide/ ] | ||
then | ||
rm -r user_guide/ | ||
fi | ||
|
||
cp -r user_guide_src/build/html/ user_guide/ | ||
cp user_guide_src/build/epub/CodeIgniter.epub "CodeIgniter ${version_number}.epub" | ||
|
||
echo "Build complete." |