Skip to content

Commit

Permalink
Update release scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bjodah committed Jun 3, 2016
1 parent 30ddacb commit 910b450
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
21 changes: 21 additions & 0 deletions scripts/post_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash -xeu
# Usage:
#
# $ ./scripts/post_release.sh v1.2.3 myserver githubuser
#
VERSION=${1#v}
SERVER=$2
GITHUBUSER=$3
PKG=$(find . -maxdepth 2 -name __init__.py -print0 | xargs -0 -n1 dirname | xargs basename)
MD5=$(md5sum dist/${PKG}-$VERSION.tar.gz | cut -f1 -d' ')
cp -r conda-recipe/ dist/conda-recipe-$VERSION
sed -i -E -e "s/version:(.+)/version: $VERSION/" -e "s/path:(.+)/fn: $PKG-$VERSION.tar.gz\n url: https:\/\/github.com\/$GITHUBUSER\/$PKG\/releases\/download\/v$VERSION\/$PKG-$VERSION.tar.gz\n md5: $MD5/" dist/conda-recipe-$VERSION/meta.yaml

env ${PKG_UPPER}_RELEASE_VERSION=v$VERSION python setup.py upload_sphinx

# Specific for this project:
scp -r dist/conda-recipe-$VERSION/ $PKG@$SERVER:~/public_html/conda-recipes/
scp dist/${PKG}-$VERSION.tar.gz $PKG@$SERVER:~/public_html/releases/
for CONDA_PY in 2.7 3.4 3.5; do
ssh $PKG@$SERVER "source /etc/profile; conda-build --python $CONDA_PY ~/public_html/conda-recipes/conda-recipe-$VERSION/"
done
22 changes: 9 additions & 13 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@
# Usage:
#
# $ ./scripts/release.sh v1.2.3 ~/anaconda2/bin
# $ ./scripts/release.sh v1.2.3 ~/anaconda2/bin upstream
#

if [[ $1 != v* ]]; then
echo "Argument does not start with 'v'"
exit 1
fi
if [[ $# == 3 ]]; then
REMOTE=origin
else
REMOTE=$4
fi
VERSION=${1#v}
./scripts/check_clean_repo_on_master.sh
cd $(dirname $0)/..
Expand All @@ -23,18 +29,8 @@ done

# All went well
git tag -a v$VERSION -m v$VERSION
git push
git push --tags
git push $REMOTE
git push $REMOTE --tags
twine upload dist/${PKG}-$VERSION.tar.gz
MD5=$(md5sum dist/${PKG}-$VERSION.tar.gz | cut -f1 -d' ')
cp -r conda-recipe/ dist/conda-recipe-$VERSION
sed -i -E -e "s/version:(.+)/version: $VERSION/" -e "s/path:(.+)/fn: $PKG-$VERSION.tar.gz\n url: https:\/\/pypi.python.org\/packages\/source\/${PKG:0:1}\/$PKG\/$PKG-$VERSION.tar.gz#md5=$MD5\n md5: $MD5/" dist/conda-recipe-$VERSION/meta.yaml
env ${PKG_UPPER}_RELEASE_VERSION=v$VERSION python setup.py upload_sphinx

# Specific for this project:
SERVER=hera
scp -r dist/conda-recipe-$VERSION/ $PKG@$SERVER:~/public_html/conda-recipes/
scp dist/${PKG}-$VERSION.tar.gz $PKG@$SERVER:~/public_html/releases/
for CONDA_PY in 2.7 3.4 3.5; do
ssh $PKG@$SERVER "source /etc/profile; conda-build --python $CONDA_PY ~/public_html/conda-recipes/conda-recipe-$VERSION/"
done
echo "Create a new release on github (with custom .tar.gz), then run ./scripts/post_release.sh ..."
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _path_under_setup(*args):
# depending on tagged version (set PYNEQSYS_RELEASE_VERSION)
# this will ensure source distributions contain the correct version
shutil.move(release_py_path, release_py_path+'__temp__')
io.open(release_py_path, 'wt', encoding='utf-8').write(
open(release_py_path, 'wt').write(
"__version__ = '{}'\n".format(__version__))
setup(**setup_kwargs)
finally:
Expand Down

0 comments on commit 910b450

Please sign in to comment.