-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish_pypi.sh
executable file
·35 lines (26 loc) · 1013 Bytes
/
publish_pypi.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
#!/bin/bash
# Load environment variables from .env file
export $(grep -v '^#' .env | xargs)
# Function to update the version number
update_version() {
version=$1
sed -i '' "s/version='[0-9]*\.[0-9]*\.[0-9]*'/version='$version'/" setup.py
}
# Get the current version
current_version=$(grep version setup.py | awk -F"'" '{print $2}')
# Increment the patch version
IFS='.' read -r -a version_parts <<< "$current_version"
version_parts[2]=$((version_parts[2] + 1))
new_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}"
# Update the version in setup.py
update_version $new_version
# Remove old builds and distribution files
rm -rf build/ dist/ airport_manager.egg-info/
# Build the package
python setup.py sdist bdist_wheel
# Commit the changes and push to GitHub
git add .
git commit -m "Publish version to $new_version"
git tag -a "v$new_version" -m "Release version $new_version"
git push origin "v$new_version"
echo "Published version $new_version to PyPI and updated GitHub."