-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·61 lines (46 loc) · 1.28 KB
/
release.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
#!/bin/bash
# Check if a tag parameter is provided and if it follows the specific pattern
if [ "$#" -ne 1 ] || ! [[ "$1" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Usage: $0 <tag> where <tag> is like 'v1.2.3'"
exit 1
fi
TAG=$1
SETUP_PY_FILE="setup.py"
# Update the version in setup.py
sed -i "8s/version=.*',/version= '$TAG',/" "$SETUP_PY_FILE"
# Check if sed command succeeded
if [ $? -ne 0 ]; then
echo "Error updating version in $SETUP_PY_FILE"
exit 1
fi
echo "Version updated to $TAG in $SETUP_PY_FILE"
# Commit the change
git add "$SETUP_PY_FILE"
git commit -m "Update version to $TAG"
# Check if git commit succeeded
if [ $? -ne 0 ]; then
echo "Error committing changes"
exit 1
fi
# Tag the commit
git tag -a "$TAG" -m "Version $TAG"
# Check if git tag succeeded
if [ $? -ne 0 ]; then
echo "Error tagging commit"
exit 1
fi
# Push the commit and tag to remote
git push origin master --tags
# Check if git push succeeded
if [ $? -ne 0 ]; then
echo "Error pushing changes"
exit 1
fi
echo "Version $TAG committed, tagged, and pushed successfully."
export PYTHONPATH=./pypaq:$PYTHONPATH
python setup.py sdist bdist_wheel
python -m twine upload -r pypi dist/*
rm -rf build
rm -rf dist
rm -rf *.egg-info
echo "Version $TAG published to pypi."