Skip to content

Commit

Permalink
fix: migrate version SSOT to setup.py and update GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bytexenon committed Nov 20, 2024
1 parent d0dc860 commit 77f1da5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
export BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})
git fetch origin $BRANCH_NAME
git checkout $BRANCH_NAME
export VERSION=$(python -c 'from undetected_geckodriver import __version__; print(__version__)')
VERSION=$(python setup.py --version)
echo $VERSION
sed -i "s/v[0-9]*\.[0-9]*\.[0-9]*/v${VERSION}/" README.md
git config --global user.name 'github-actions[bot]'
Expand Down
13 changes: 1 addition & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,10 @@
LONG_DESC = open(os.path.join(DIRNAME, "README.md")).read()


# Read the version from the __init__.py file #
def find_version():
with open(
os.path.join(DIRNAME, "undetected_geckodriver", "__init__.py"), encoding="utf-8"
) as f:
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", f.read(), re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")


# Setup #
setup(
name="undetected-geckodriver",
version=find_version(),
version="1.0.6",
packages=["undetected_geckodriver"],
install_requires=["selenium>=4.10.0", "psutil>=5.8.0"],
include_package_data=True,
Expand Down
8 changes: 5 additions & 3 deletions undetected_geckodriver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
Author: Bytexenon (https://github.com/Bytexenon)
"""

# Version #
__version__ = "1.0.6"

# Imports #
import importlib.metadata

from .driver import Firefox

# Constants #
__version__ = importlib.metadata.version("undetected-geckodriver")

0 comments on commit 77f1da5

Please sign in to comment.