Files
CoolProp/dev/scripts/release.bsh

87 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
#
# Make sure that only one argument is passed to this script - the version that will be released
if [ $# != 2 ]; then
echo "Only two arguments should be passed to this script - the version that will be released and if you would like a dry run or a release; like \"release.bsh 5.0.0 dryrun\" or \"release.bsh nightly release\"."
exit 1
fi
#
CPVERSION="$1"
BASEDIR="$HOME/buildbot/server-master/public_html"
BINFOLDER="binaries"
DOCFOLDER="sphinx"
SEPARATOR="----------------------------------"
#
SFUSER="jorritw" # ibell or jorritw
#
#
echo " "
echo $SEPARATOR
echo "Processing the input variables: "
#
CPVERSION="$1"
if [[ $CPVERSION == +([0-9]).+([0-9]).+([0-9]) ]]; then
echo "CPVERSION = $CPVERSION"
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"
#
# Change the folder
pushd ${BASEDIR}
#echo "Fixing the permissions of directories and files" # This is not needed, just ignore the perms in rsync
#find . -type d ! -perm 0775 -exec chmod 0775 {} \;
#find . -type f ! -perm 0664 -exec chmod 0664 {} \;
#
if [ "$DRYRUN" != "false" ]; then
echo " "
echo $SEPARATOR
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
if [ "$CPVERSION" = "nightly" ]; then
RSYNC_OPTS="-a --no-perms -z --stats --delete"
rm -rf "$BINFOLDER/docs"
CPVERSION="$CPVERSION"/ #$(date +%F)
else
RSYNC_OPTS="-a --no-perms -z --stats"
echo " "
echo $SEPARATOR
echo "Zipping up the docs and moving them into the $BINFOLDER folder for staging"
rm -f documentation.zip
zip -rq documentation.zip $DOCFOLDER/*
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
#
echo " "
echo $SEPARATOR
echo "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
echo " "
echo $SEPARATOR
echo "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
echo " "
echo "All done, goodbye."
exit 0