Skip to content

Commit 750259f

Browse files
committed
BNCASB: Adding update script to help update the version and publish package to PyPI
1 parent 873433f commit 750259f

File tree

3 files changed

+60
-23
lines changed

3 files changed

+60
-23
lines changed

.circleci/config.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ workflows:
55
jobs:
66
- test-python-3-7
77
- test-python-2-7
8-
- bump-version:
9-
requires:
10-
- test-python-3-7
11-
- test-python-2-7
128
jobs:
139
test-python-3-7: &test-template
1410
docker:
@@ -28,21 +24,3 @@ jobs:
2824
<<: *test-template
2925
docker:
3026
- image: circleci/python:2.7.16
31-
bump-version:
32-
docker:
33-
- image: circleci/python:3.7.6
34-
steps:
35-
- add_ssh_keys
36-
- checkout
37-
- run:
38-
name: Update version number
39-
command: |
40-
sudo apt-get install bc
41-
OLD_VER=$(cat VERSION) && NEW_VER=$(echo $OLD_VER + .01 | bc) && echo $NEW_VER > VERSION
42-
echo $OLD_VER
43-
echo $NEW_VER
44-
cat VERSION
45-
- run:
46-
name: Push to GitHub
47-
command: |
48-
echo "pushing to github..."

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
README = open(os.path.join(here, 'README.md')).read()
77

88
setup(
9-
name='django-task-sqs',
9+
name='django-eb-sqs',
1010
version=VERSION,
1111
package_dir={'eb_sqs': 'eb_sqs'},
1212
include_package_data=True,

update.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
echo "Usage: $0 [option] ...
2+
-u or --update : update the version and commit to Github
3+
-p or --publish : publish the package to PyPI
4+
-h or --help : help
5+
"
6+
7+
for arg in "$@"
8+
9+
do
10+
if [ "$arg" == "--update" ] || [ "$arg" == "-u" ]
11+
then
12+
# bump the version
13+
echo "Updating the package version..."
14+
OLD_VER=$(cat VERSION)
15+
NEW_VER=$(echo "$OLD_VER" + .01 | bc)
16+
echo "$NEW_VER" > VERSION
17+
echo "Version bumped to $NEW_VER"
18+
19+
# push to git
20+
echo "Pushing to GitHub..."
21+
git commit -m "Bump the version to $NEW_VER"
22+
git add VERSION
23+
git commit -a -m "Bump the version to $NEW_VER"
24+
git push
25+
26+
# adding tag
27+
echo "Adding Tag..."
28+
TAG="v$NEW_VER"
29+
echo "$TAG"
30+
git tag -a "$TAG" -m "Bumped the version to $NEW_VER"
31+
git push origin "$TAG"
32+
33+
fi
34+
35+
# publish to PyPI
36+
if [ "$arg" == "--publish" ] || [ "$arg" == "-p" ]
37+
then
38+
echo "Pushing the package to PyPI...
39+
Note: Please have setuptools, wheel and twine packages installed."
40+
41+
# creating the distribution package
42+
rm -rf dist/
43+
python setup.py sdist
44+
python setup.py bdist_wheel
45+
twine upload dist/*
46+
47+
fi
48+
49+
50+
# help
51+
if [ "$arg" == "--help" ] || [ "$arg" == "-h" ]
52+
then
53+
echo "Usage: $0 [option] ...
54+
-u or --update : update the version and commit to Github
55+
-p or --publish : publish the package to PyPI
56+
-h or --help : help"
57+
fi
58+
done
59+

0 commit comments

Comments
 (0)