diff --git a/.travis.yml b/.travis.yml index 6505c16d4..3802de8e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -70,4 +70,4 @@ after_success: # ANACONDA_ORG_UPLOAD_TOKEN is a secret token # used in Travis CI config, originally # generated at anaconda.org for scipy-wheels-nightly (cron jobs). - - if [[ $CIBW_ARCHS == aarch64 && "$TRAVIS_EVENT_TYPE" == "cron" ]]; then bash ci/upload_wheels.sh; fi + - if [[ $CIBW_ARCHS == aarch64 ]]; then bash ci/upload_wheels.sh; fi diff --git a/ci/upload_wheels.sh b/ci/upload_wheels.sh index 23ffb5f3b..98e692e2c 100644 --- a/ci/upload_wheels.sh +++ b/ci/upload_wheels.sh @@ -1,17 +1,29 @@ ANACONDA_ORG="scipy-wheels-nightly"; pip install git+https://github.com/Anaconda-Server/anaconda-client; -# rename wheels -# appending timestamp to wheels package name -# e.g. h5py-3.3.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl to h5py-3.3.0-20211004151033-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -for whl in ${TRAVIS_BUILD_DIR}/wheelhouse/h5py-*.whl; do - newname=$(echo "$whl" | sed "s/\(h5py-[0-9][0-9]*[.[0-9]*]*-\)\(cp*\)/\1$(date '+%Y%m%d%H%M%S')-\2/") - if [ "$newname" != "$whl" ]; then - mv $whl $newname - fi -done +if [[ "$TRAVIS_EVENT_TYPE" != "cron" && -z "$TRAVIS_TAG" ]] ; then + echo "Not uploading wheels (build not for cron or git tag)" + exit 0 +fi + +# rename wheels if not on a tag +# inserting commit count & hash from git describe +# e.g. h5py-3.3.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl to +# h5py-3.3.0-3-g4320f2ea-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl +if [[ -z "$TRAVIS_TAG" ]] ; then + descr=$(git describe --tags) + descr=${descr#*-} # Chop off tag (should be version number) + build_tag=${descr//-/_} # Convert - to _ for build tag + echo "Setting build tag to ${build_tag}" + for whl in "${TRAVIS_BUILD_DIR}"/wheelhouse/h5py-*.whl; do + newname=$(echo "$whl" | sed "s/\(h5py-[0-9][0-9]*[.[0-9]*]*-\)\(cp*\)/\1${build_tag}-\2/") + if [ "$newname" != "$whl" ]; then + mv "$whl" "$newname" + fi + done +fi # upload wheels if [[ -n "${ANACONDA_ORG_UPLOAD_TOKEN}" ]] ; then - anaconda -t ${ANACONDA_ORG_UPLOAD_TOKEN} upload --force -u ${ANACONDA_ORG} ${TRAVIS_BUILD_DIR}/wheelhouse/h5py-*.whl; + anaconda -t ${ANACONDA_ORG_UPLOAD_TOKEN} upload -u ${ANACONDA_ORG} "${TRAVIS_BUILD_DIR}"/wheelhouse/h5py-*.whl; fi;