forked from htseq/htseq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.ci_deploy.sh
executable file
·96 lines (85 loc) · 2.77 KB
/
.ci_deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
if [ $OS_NAME == 'macos-latest' ]; then
# only deploy builds for a release_<sematic-version>_RC?? tag to testpypi
if [ -z $GITHUB_REF ]; then
echo 'No GITHUB_REF, exit'
exit 0
fi
TAG=$(echo $GITHUB_REF | cut -f3 -d/)
TAG1=$(echo $TAG | cut -f1 -d_)
TAG2=$(echo $TAG | cut -f2 -d_)
TAG3=$(echo $TAG | cut -f3 -d_)
echo "GITHUB_REF: ${GITHUB_REF}, TAG: ${TAG}, TAG1: ${TAG1}, TAG2: ${TAG2}, TAG3: ${TAG3}"
if [ -z $TAG2 ]; then
echo 'No TAG2, exit'
exit 0;
fi
if [ $TAG1 != 'release' ] || [ $TAG2 != $(cat VERSION) ]; then
echo 'No release tag or wrong version, exit'
exit 0;
fi
# do not deploy on linux outside of manylinux
if [ -z $DOCKER_IMAGE ] && [ $OS_NAME != 'macos-latest' ]; then
echo 'Not inside manylinux docker image and not OSX, exit'
exit 0
fi
# deploy onto pypitest unless you have no RC
if [ -z $TAG3 ]; then
TWINE_PASSWORD=${TWINE_PASSWORD_PYPI}
TWINE_REPOSITORY='https://upload.pypi.org/legacy/'
echo 'Deploying to production pypi'
elif [ ${TAG3:0:2} == 'RC' ]; then
TWINE_PASSWORD=${TWINE_PASSWORD_TESTPYPI}
TWINE_REPOSITORY='https://test.pypi.org/legacy/'
echo 'Deploying to testpypi'
else
echo "Tag not recognized: $GITHUB_REF"
exit 1
fi
echo "Deploying for OSX"
# Prepare to exit upon failure
set -e
# Only deploy on 10.14 to ensure 10.9+ compatibility and Mojave header/linker changes
# NOTE: try deploying on 11.6.5 and see if it works
osx_version=$(sw_vers -productVersion)
echo "OSX version: $osx_version"
osx_ver1=$(echo $osx_version | cut -d. -f1)
osx_ver2=$(echo $osx_version | cut -d. -f2)
if [ $osx_ver1 -lt 11 ] || [ $osx_ver2 -lt 6 ]; then
echo "OSX version not for deployment (<11.6): $osx_version"
exit 1
fi
HTSEQ_VERSION=$(cat VERSION)
echo "TWINE_REPOSITORY=$TWINE_REPOSITORY"
echo "TWINE_USERNAME=$TWINE_USERNAME"
echo "TWINE_PASSWORD=$TWINE_PASSWORD"
export PATH="$HOME/miniconda/bin:$PATH"
source $HOME/miniconda/bin/activate
conda activate ci
# make wheel
mkdir wheelhouse
pip wheel . -w wheelhouse/
if [ $? != 0 ]; then
exit 1
fi
echo "Contents of wheelhouse:"
ls wheelhouse
echo "Figure out architecture string for wheel..."
PYVER=$(echo $CONDA_PY | sed 's/\.//')
PYARCH=cp${PYVER}-cp${PYVER}
TWINE_WHEEL=$(ls wheelhouse/HTSeq-${HTSEQ_VERSION}-${PYARCH}*.whl)
echo "TWINE_WHEEL=$TWINE_WHEEL"
echo "Install twine for upload..."
pip --version
pip install twine
echo "Uploading..."
twine upload --repository-url "${TWINE_REPOSITORY}" -u "${TWINE_USERNAME}" -p "${TWINE_PASSWORD}" "${TWINE_WHEEL}"
if [ $? != 0 ]; then
echo "Upload of wheel failed"
exit 1
fi
echo "Upload of wheel complete"
else
echo "No DOCKER_IMAGE and not OSX, we should not be here!"
exit 1
fi