-
Notifications
You must be signed in to change notification settings - Fork 1
/
pypi_relese.sh
executable file
·45 lines (38 loc) · 1.29 KB
/
pypi_relese.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
#!/bin/bash
#
#
cd $(dirname "$0")
currversion=$(git rev-parse --abbrev-ref HEAD)
echo $currversion
if [[ "$currversion" =~ v[0-9]\. ]]; then
verparts=($(echo $currversion | tr "-" "\n"))
len=${#verparts[@]}
if [ $len -gt 1 ]; then
txtversion=${verparts[0]}-${verparts[1]}
else
txtversion=${verparts[0]}
fi
numver=$(echo $currversion | sed -E 's/v([^-]*)/\1/')
echo numver\: $numver
version=$numver
echo version\: $version
# sed -i '' -e "s/version *= *\"[^\"]*\"/version = \"${version}\"/" $(find . -name "*.py")
# This was the macos way
# sed -i '' -e "s/version=\"[^\"]*\"/version=\"${version}\"/" $(find . -name "*.py")
# sed -i '' -e "s/version = \"[^\"]*\"/version = \"${version}\"/" $(find . -name "*.py")
# this is the linux way
sed -i -e "s/version = \"[^\"]*\"/version = \"${version}\"/" $(find . -name "*.py")
sed -i -e "s/version=\"[^\"]*\"/version=\"${version}\"/" $(find . -name "*.py")
# Version Test
# This was the macos way
# sed -i '' -e "s/# Version .*/# Version ${version}/" $(find . -name "*.py")
# this is the linux way
sed -i -e "s/# Version .*/# Version ${version}/" $(find . -name "*.py")
git commit -m "Version ${version}" -a
# git push
rm -R dist/
rm -R build/
python3 setup*.py sdist bdist_wheel
python3 -m twine upload dist/*${version}*
fi
cd -