-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added publish task to travis and updated library version dependency * Added the publish script
- Loading branch information
andamian
authored
Sep 20, 2017
1 parent
84a9892
commit 416afc5
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
# Deploys a Python library or application | ||
|
||
product=$(echo $TRAVIS_TAG | awk -F '=' '{print $1}') | ||
version=$(echo $TRAVIS_TAG | awk -F '=' '{print $2}') | ||
if [ -z "$product" ]; then | ||
echo "Could not find name of product in TRAVIS_TAG: $TRAVIS_TAG"; | ||
exit -1 | ||
fi | ||
if [ -z "$version" ]; then | ||
echo "Could not find version of product in TRAVIS_TAG: $TRAVIS_TAG"; | ||
exit -1 | ||
fi | ||
|
||
echo "Deploying $product, version $version..." | ||
cd $product || { echo "Project $product does not exist in this repo"; exit -1; } | ||
# check that the version in the tag and in setup.cfg match | ||
sed 's/ //g' setup.cfg | grep "^version=$version" || { \ | ||
echo "Version in tag ($version) does not match version in setup.cfg \ | ||
($(sed 's/ //g' setup.cfg | grep '^version=' | awk -F '=' '{print $2}'))"; \ | ||
exit -1; } | ||
|
||
# build | ||
python setup.py clean sdist || { echo "Errors building $product"; exit -1; } | ||
# upload to pypi | ||
# generate the .pypirc file first | ||
echo "[pypi]" > .pypirc | ||
chmod 600 .pypirc | ||
echo "username = Canadian.Astronomy.Data.Centre" >> .pypirc | ||
echo "password = ${PYPI_PASSWORD}" >> .pypirc | ||
|
||
echo "Publish on pypi" | ||
twine upload --config-file .pypirc dist/* || { echo "Errors publishing $TRAVIS_TAG"; exit -1; } | ||
|
||
# check version available | ||
pip uninstall -y $product | ||
pip install --upgrade --pre $product==$version || { echo "$TRAVIS_TAG not installed on pypi" ; exit -1; } |