-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
66 lines (56 loc) · 1.16 KB
/
publish.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
#!/bin/bash
SOURCE_DIST=/py-bbn/dist/pybbn-${PYBBN_VERSION}.tar.gz
buildCode() {
echo "start the build"
cd /py-bbn \
&& make clean \
&& make \
&& python setup.py sdist bdist bdist_wheel \
&& twine check dist/* \
&& cd /py-bbn/docs \
&& make html
}
updateVersion() {
echo "replace version of software to ${PYBBN_VERSION}"
sed -i "s/version='0.2.3'/version='${PYBBN_VERSION}'/g" /py-bbn/setup.py
}
copyCredentials() {
if [[ -f /py-bbn/.pypirc ]]; then
echo "copying over .pypirc"
cp /py-bbn/.pypirc /root/.pypirc
fi
}
publish() {
echo "python publish"
if [[ -f /root/.pypirc ]]; then
if [[ -f ${SOURCE_DIST} ]]; then
echo "uploading source"
cd /py-bbn \
&& make clean \
&& python setup.py sdist \
&& twine upload --repository ${PYPI_REPO} ${SOURCE_DIST}
else
echo "no ${SOURCE_DIST} found!"
fi
else
echo "no .pypirc found!"
fi
}
cleanUp() {
if [[ -f /root/.pypirc ]]; then
echo "cleaning up"
rm -f /root/.pypirc
fi
}
build() {
echo "python build"
buildCode
publish
}
conda init bash
. /root/.bashrc
updateVersion
copyCredentials
build
cleanUp
echo "done!"