Files
CoolProp/dev/scripts/release.bsh
Ian Bell 8208577db2 More revision synchronization; See #363
Two steps:
1) Force all builders on the release branch. This will upload all binaries to public_html/release
2) Force the release builder, this will make the release from the files in public_html/release

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-12-31 11:48:08 -05:00

117 lines
4.0 KiB
Bash
Executable File

#!/bin/bash
#
# Make sure that only two arguments are passed to this script - the version that
# will be released and the dryrun vs. release option.
if [ $# != 2 ]; then
echo "Only two arguments should be passed to this script: "
echo "The version that will be released and if you would like a dry run or a release."
echo "for example: \"release.bsh 5.0.0 dryrun\" or \"release.bsh nightly release\" "
exit 1
fi
#
CPVERSION="$1"
BASEDIR="$HOME/buildbot/server-master/public_html"
REPODIR="$HOME/src/CoolPropFull.git"
TMPSDIR="$HOME/src/CoolProp.sources"
BINFOLDER="binaries"
DOCFOLDER="sphinx"
SRCFOLDER="$BASEDIR/$BINFOLDER/source"
DOC4FILES="4.2.5/coolpropv425docs.zip"
DOC4FOLDER="$DOCFOLDER/v4"
SEPARATOR="----------------------------------"
#
SFUSER="jorritw" # ibell or jorritw
#
function printMessage {
echo " "
echo $SEPARATOR
echo "$1"
return 0
}
#
printMessage "Processing the input variables: "
#
CPVERSION="$1"
if [[ $CPVERSION == +([0-9]).+([0-9]).+([0-9]) ]]; then
echo "CPVERSION = $CPVERSION"
BINFOLDER=release
elif [ "$CPVERSION" == "nightly" ]; then
echo "CPVERSION = $CPVERSION - which is a valid input"
else
echo "CPVERSION = $CPVERSION - not valid!"
exit 1
fi
#
if [ "$2" == "release" ]; then
DRYRUN=false
else
DRYRUN=true
fi
echo "DRYRUN = $DRYRUN"
pushd ${BASEDIR} # Change the folder
if [ "$DRYRUN" != "false" ]; then
printMessage "Dry run detected"
echo "Dry run; no zipping of the sources"
echo "Dry run; no zipping of the docs"
echo "Dry run; skipping python upload"
echo "Dry run; skipping folder date"
RSYNC_DRY_RUN=--dry-run
else
printMessage "Updating sources"
pushd "$REPODIR"
git pull
git submodule update
#python dev/scripts/git-archive-all $SRCFOLDER/CoolProp_sources.zip
popd
printMessage "Generating headers"
rsync -a --delete "$REPODIR/" "$TMPSDIR"
pushd "$TMPSDIR"
git reset --hard HEAD
python "dev/generate_headers.py"
#rm -rf .git*
find . -iwholename "*/.git*" -exec rm -rf {} \;
cd ..
rm $SRCFOLDER/CoolProp_sources.zip
zip -r $SRCFOLDER/CoolProp_sources.zip $(basename $TMPSDIR)
cd $(basename $TMPSDIR)
popd
rm -f "$BINFOLDER/README.rst.txt"
if [ "$CPVERSION" = "nightly" ]; then
RSYNC_OPTS="-a --no-perms -z --stats --delete"
rm -rf "$BINFOLDER/docs"
CPVERSION="$CPVERSION"/ #$(date +%F)
echo "CoolProp nightly binaries" > "$BINFOLDER/README.rst.txt"
echo "-------------------------" >> "$BINFOLDER/README.rst.txt"
echo -n "Development binaries of the" >> "$BINFOLDER/README.rst.txt"
echo -n " \`CoolProp project <http://coolprop.sourceforge.net>\`_ " >> "$BINFOLDER/README.rst.txt"
echo "updated on $(date +%F) at $(date +%X) $(date +%Z)." >> "$BINFOLDER/README.rst.txt"
else
RSYNC_OPTS="-a --no-perms -z --stats"
printMessage "Zipping up the docs and moving them into the $BINFOLDER folder for staging"
rm -f documentation.zip
zip -rq documentation.zip $DOCFOLDER/* -x */$(basename $DOC4FOLDER)/*
mkdir -p "$BINFOLDER/docs"
cp documentation.zip "$BINFOLDER/docs"
echo "Uploading the python binaries to pypi"
twine upload $BINFOLDER/Python/*.whl $BINFOLDER/Python/*.tar.gz
fi
RSYNC_DRY_RUN=
fi
#
printMessage "Getting the latest v4 docs from SourceForge"
rsync $RSYNC_DRY_RUN $RSYNC_OPTS "frs.sf.net-$SFUSER:/home/frs/project/coolprop/CoolProp/$DOC4FILES" "$(basename $DOC4FILES)"
mkdir -p "$DOC4FOLDER"
unzip -qo "$(basename $DOC4FILES)" -d "$DOC4FOLDER"
#
printMessage "Copying the binaries to SourceForge"
rsync $RSYNC_DRY_RUN $RSYNC_OPTS "$BINFOLDER/" frs.sf.net-$SFUSER:/home/frs/project/coolprop/CoolProp/$CPVERSION
if [ ${CPVERSION:0:7} != "nightly" ]; then
printMessage "Publishing the docs on SourceForge"
rsync $RSYNC_DRY_RUN $RSYNC_OPTS "$DOCFOLDER/" frs.sf.net-$SFUSER:/home/project-web/coolprop/htdocs
fi
# Change back to where we came from
popd
printMessage "All done, goodbye."
exit 0