summaryrefslogtreecommitdiffstats
path: root/build-release.sh
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-10-28 17:34:05 +0200
committerAndrey Andreev <narf@devilix.net>2016-10-28 17:34:05 +0200
commit67b40a561111a5a65faa245cd4c575e8d945cfb8 (patch)
tree4c9d3c66d666f3a781299e11806a5ff1d11fc3ba /build-release.sh
parentdf34b547c97ba1ce1ddb819495d299cb845a87de (diff)
parent499c6080cd41927df088206155e4055d4da3e58e (diff)
Merge branch '3.1-stable' into develop
Resolved conflicts: system/core/CodeIgniter.php user_guide_src/source/changelog.rst user_guide_src/source/conf.py user_guide_src/source/installation/downloads.rst user_guide_src/source/installation/upgrading.rst user_guide_src/source/libraries/form_validation.rst
Diffstat (limited to 'build-release.sh')
-rwxr-xr-xbuild-release.sh99
1 files changed, 99 insertions, 0 deletions
diff --git a/build-release.sh b/build-release.sh
new file mode 100755
index 000000000..6b3b31d12
--- /dev/null
+++ b/build-release.sh
@@ -0,0 +1,99 @@
+#!/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 [ `grep -c -F --regexp="$version_number (Current version) <https://codeload.github.com/bcit-ci/CodeIgniter/zip/$version_number>" user_guide_src/source/installation/downloads.rst` -ne 1 ]
+then
+ echo "user_guide_src/source/installation/downloads.rst doesn't appear to contain a link for this version"
+ 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."