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