Sample Jenkins build script to generate output via DITA-OT & copy results to web server
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
#!/bin/bash | |
# This script is run by Jenkins to execute all tests. | |
# It gets passed two parameters, the first one is either "ci" or "nightly" to | |
# indicate what kind of tests should be run. The second one is the branch that | |
# is being tested. This script should either work for all branches (makes | |
# merging easier) or each branch contains code that is specific for this branch, | |
# in which case you might want to double check that everything works after | |
# merging. | |
# Call this script (`build-files/jenkins`) in the Build section of the Jenkins | |
# job configuration via Add build step > Execute shell > command: | |
# BRANCH=$(basename $GIT_BRANCH) | |
# ./build-files/jenkins ci $BRANCH | |
if [ "$1" == "ci" ]; then | |
echo "Continuous integration check for branch $2" | |
RET=0 | |
set +e # if one command fails then exit | |
# Run documentation build script, which sets up the DITA-OT environment & runs Ant tasks to build output | |
bash build-files/build.sh | |
BRANCH=$(basename $GIT_BRANCH) | |
# Clean & re-create target output directory before moving the new generated output | |
rm -r /var/www/$BRANCH/manual | |
mkdir /var/www/$BRANCH/manual | |
# Copy all `output` subfolders to Web server "as-is" | |
cp -r output/* /var/www/$BRANCH/manual | |
exit $RET | |
elif [ "$1" == "nightly" ]; then | |
echo "Nightly check for branch $2" | |
RET=0 | |
#make || RET=1 | |
exit $RET | |
else | |
echo "Unknown parameter: $1" && exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment