-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
publish.sh
executable file
·66 lines (56 loc) · 1.14 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=/code/dist/ydot-${API_VERSION}.tar.gz
buildCode() {
echo "start the build"
cd /code \
&& make clean \
&& make \
&& python setup.py sdist bdist bdist_wheel \
&& twine check dist/* \
&& cd /code/docs \
&& make html
}
updateVersion() {
echo "replace version of software to ${API_VERSION}"
sed -i "s/version='0.2.3'/version='${API_VERSION}'/g" /code/setup.py
}
copyCredentials() {
if [[ -f /code/.pypirc ]]; then
echo "copying over .pypirc"
cp /code/.pypirc /root/.pypirc
fi
}
publish() {
echo "python publish"
if [[ -f /root/.pypirc ]]; then
if [[ -f ${SOURCE_DIST} ]]; then
echo "uploading source"
cd /code \
&& 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!"