-
Notifications
You must be signed in to change notification settings - Fork 5
/
version.sh
executable file
·49 lines (38 loc) · 1.21 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
#!/bin/bash
#echo "Testing app"...
#python3 -m pytest ./tests
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 "Updating pypi tools..."
#python3 -m pip install --user --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
actionpi/app.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/*