-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
publish.sh
executable file
·63 lines (53 loc) · 1.07 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
#!/bin/bash
SOURCE_DIST=/py-pair/dist/pypair-${API_VERSION}.tar.gz
buildCode() {
echo "start the build"
cd /py-pair \
&& make clean \
&& make \
&& twine check dist/*
}
updateVersion() {
echo "replace version of software to ${API_VERSION}"
sed -i "s/version = 0.0.1/version = ${API_VERSION}/g" /py-pair/setup.cfg
}
copyCredentials() {
if [[ -f /py-pair/.pypirc ]]; then
echo "copying over .pypirc"
cp /py-pair/.pypirc /root/.pypirc
fi
}
publish() {
echo "python publish"
if [[ -f /root/.pypirc ]]; then
if [[ -f ${SOURCE_DIST} ]]; then
echo "uploading source"
cd /py-pair \
&& 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!"