-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion.sh
executable file
·70 lines (45 loc) · 1.38 KB
/
version.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
64
65
66
67
68
69
70
#!/bin/bash
echo "Check if checkout on master"
CURRENT_BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD)
echo "Current branch is: $CURRENT_BRANCH"
if [ $CURRENT_BRANCH != "master" ]; then
echo "Not checked out master, aborting..."
exit 1
fi
echo "Testing app"...
source venv/bin/activate
pip install -r requirements.txt --upgrade --force-reinstall
python3 -m pytest ./tests
if [ $? != 0 ]; then
echo "Test: FAILED"
exit 1
fi
echo "Test: PASSED"
echo "Updating pypi tools..."
python3 -m pip install --upgrade setuptools wheel twine
echo "Cleaning temp directories..."
rm -rf build/ dist/ pycommon_andreacioni.egg-info/
echo "Creating new version"
FILE=setup.py
CURRENT_VERSION=$(cat $FILE | grep version | awk '{print $1}' | cut -d '"' -f 2)
TO_UPDATE=(
setup.py
weekly_menu/__init__.py
)
echo "Current version is: $CURRENT_VERSION. Enter new version:"
read NEW_VERSION
echo "New version is: $NEW_VERSION"
for file in "${TO_UPDATE[@]}"
do
echo "Patching $file ..."
sed -i '' "s/$CURRENT_VERSION/$NEW_VERSION/g" $file
git add $file
done
git commit -m "Releasing v$NEW_VERSION"
git push
git tag -a v$NEW_VERSION -m "Release v$NEW_VERSION"
git push origin v$NEW_VERSION
echo "Creating version for PyPi"
python3 setup.py sdist bdist_wheel
echo "Uploading to PyPi"
python3 -m twine upload --repository-url https://upload.pypi.org/legacy/ dist/*