diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8af60fe --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: publish pyright-python + +on: + # Trigger after Test has completed on main + workflow_run: + workflows: ["Test"] + branches: [main] + paths: + - "pyright/_version.py" + types: + - completed + +jobs: + publish_release: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - run: | + pip install -r dev-requirements.txt + python setup.py sdist bdist_wheel + twine upload -u ${{ secrets.PYPI_USER }} -p ${{ secrets.PYPI_PASS }} dist/* diff --git a/dev-requirements.txt b/dev-requirements.txt index 8dceb75..aa0db81 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,2 +1,4 @@ tox semver==3.0.0.dev3 +twine +wheel diff --git a/pyright/__init__.py b/pyright/__init__.py index 5c01a2f..bc90ac6 100644 --- a/pyright/__init__.py +++ b/pyright/__init__.py @@ -5,9 +5,11 @@ __author__ = 'RobertCraigie' __license__ = 'MIT' __copyright__ = 'Copyright 2021 Robert Craigie' -__version__ = '0.0.13' -__pyright_version__ = '1.1.223' +from ._version import ( + __version__ as __version__, + __pyright_version__ as __pyright_version__, +) import os from . import errors as errors diff --git a/pyright/_version.py b/pyright/_version.py new file mode 100644 index 0000000..7ed99bb --- /dev/null +++ b/pyright/_version.py @@ -0,0 +1,2 @@ +__version__ = '0.0.13.post0' +__pyright_version__ = '1.1.223' diff --git a/setup.py b/setup.py index 3b46a1f..7405207 100755 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ readme = f.read() version = '' -with open('pyright/__init__.py') as f: +with open('pyright/_version.py') as f: match = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE) if not match: raise RuntimeError('version is not set') diff --git a/version.py b/version.py index c1ced81..bb547ab 100644 --- a/version.py +++ b/version.py @@ -6,7 +6,7 @@ def get_pyright_version() -> str: - with open('pyright/__init__.py') as f: + with open('pyright/_version.py') as f: match = re.search( r'^__pyright_version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE ) @@ -21,18 +21,23 @@ def compare(ver: str) -> bool: def set_pyright_ver(ver: str): - with fileinput.input('pyright/__init__.py', inplace=True) as f: + with fileinput.input('pyright/_version.py', inplace=True) as f: for line in f: line = re.sub( r'^__pyright_version__\s*=\s*[\'"]([^\'"]*)[\'"]', f"__pyright_version__ = '{ver}'", line.rstrip(), ) + line = re.sub( + r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', + f"__version__ = '{ver}'", + line.rstrip(), + ) print(line) def bump_pyright_package_ver(): - with fileinput.input('pyright/__init__.py', inplace=True) as f: + with fileinput.input('pyright/_version.py', inplace=True) as f: for line in f: line = line.rstrip() current_version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', line) @@ -70,4 +75,3 @@ def bump_pyright_package_ver(): print('0') elif args.set != None: set_pyright_ver(args.set[0]) - bump_pyright_package_ver()