2018-09-05 17:10:05 -04:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
# Release packages to PyPI
|
2015-11-19 16:31:34 -05:00
|
|
|
|
|
|
|
|
if [ "`dirname $0`" != "tools" ] ; then
|
|
|
|
|
echo Please run this script from the repo root
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2015-12-11 17:30:04 -05:00
|
|
|
CheckVersion() {
|
2018-09-05 17:10:05 -04:00
|
|
|
# Args: <version number>
|
|
|
|
|
if ! echo "$1" | grep -q -e '[0-9]\+.[0-9]\+.[0-9]\+' ; then
|
2015-12-11 17:30:04 -05:00
|
|
|
echo "$1 doesn't look like 1.2.3"
|
2018-09-05 17:10:05 -04:00
|
|
|
echo "Usage:"
|
|
|
|
|
echo "$0 RELEASE_VERSION NEXT_VERSION"
|
2015-12-11 17:30:04 -05:00
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-05 17:10:05 -04:00
|
|
|
CheckVersion "$1"
|
|
|
|
|
CheckVersion "$2"
|
2015-09-26 19:56:18 -04:00
|
|
|
|
2018-09-05 17:10:05 -04:00
|
|
|
if [ "$RELEASE_GPG_KEY" = "" ] && ! gpg2 --card-status >/dev/null 2>&1; then
|
|
|
|
|
echo OpenPGP card not found!
|
|
|
|
|
echo Please insert your PGP card and run this script again.
|
|
|
|
|
exit 1
|
2015-12-11 20:57:26 -05:00
|
|
|
fi
|
2016-02-10 23:04:28 -05:00
|
|
|
|
2018-09-05 17:10:05 -04:00
|
|
|
if ! command -v script >/dev/null 2>&1; then
|
|
|
|
|
echo The command script was not found.
|
|
|
|
|
echo Please install it.
|
2016-02-10 23:04:28 -05:00
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2018-09-05 17:10:05 -04:00
|
|
|
export RELEASE_DIR="./releases"
|
|
|
|
|
mv "$RELEASE_DIR" "$RELEASE_DIR.$(date +%s).bak" || true
|
|
|
|
|
LOG_PATH="log"
|
|
|
|
|
mv "$LOG_PATH" "$LOG_PATH.$(date +%s).bak" || true
|
2016-02-19 12:36:11 -05:00
|
|
|
|
2018-09-05 17:10:05 -04:00
|
|
|
# Work with both Linux and macOS versions of script
|
|
|
|
|
if script --help | grep -q -- '--command'; then
|
|
|
|
|
script --command "tools/_release.sh $1 $2" "$LOG_PATH"
|
|
|
|
|
else
|
|
|
|
|
script "$LOG_PATH" tools/_release.sh "$1" "$2"
|
2015-12-12 03:38:45 -05:00
|
|
|
fi
|