Skip to content

Commit dd0a888

Browse files
committed
added bash upload
1 parent 5f0db4c commit dd0a888

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

upload.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
# Command to upload new version release at pypi
4+
# ./upload.sh pypi
5+
if [ "$1" == "pypi" ]; then
6+
python setup.py sdist upload -r pypi
7+
fi
8+
9+
if [ "$1" == "git" ]; then
10+
11+
# Command to upload new tag version
12+
# by checking the last version release.
13+
# ./upload.sh git tag
14+
if [ "$2" == "tag" ]; then
15+
# check last release version and plus it with 1
16+
# eg: 1.0.8 => 1.0.9
17+
new_version=$(
18+
git tag | tail -n1 | awk -F '[/.]' '{ gsub("v", "", $1); print $1$2$3 + 1}' | fold -w1 | paste -sd.
19+
);
20+
# echo "git tag -a v$new_version -m 'Release v$new_version'";
21+
git tag -a "v$new_version" -m "Release v$new_version";
22+
git push origin "v$new_version";
23+
echo "Current version: v$new_version";
24+
fi
25+
26+
# Command to push new git commit
27+
# ./upload.sh git commit
28+
if [ "$2" == "commit" ]; then
29+
echo -n "Commit name > ";
30+
read commit_name
31+
32+
if [ "$commit_name" ]; then
33+
git add .;
34+
git commit -m "$commit_name";
35+
git push -u origin master;
36+
fi
37+
fi
38+
fi

0 commit comments

Comments
 (0)