diff --git a/.github/workflows/publish_to_pypi.yml b/.github/workflows/publish_to_pypi.yml index 85708aa..a6cf1f2 100644 --- a/.github/workflows/publish_to_pypi.yml +++ b/.github/workflows/publish_to_pypi.yml @@ -1,11 +1,13 @@ -name: Publish Python distributions to PyPI +# Reference for this action: +# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries +name: Publish to PyPI -# Only trigger, when the build CI workflow succeeded on: - workflow_run: - workflows: ["CI"] - types: - - completed + release: + types: [ published ] + +permissions: + contents: read jobs: deploy: @@ -13,18 +15,22 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: '3.x' + - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - if: startsWith(github.ref, 'refs/tags') # Only runs if commit is tagged - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* \ No newline at end of file + pip install setuptools wheel + + - name: Build package + run: python setup.py sdist bdist_wheel + + - name: Publish package + # GitHub recommends pinning 3rd party actions to a commit SHA. + uses: pypa/gh-action-pypi-publish@37f50c210e3d2f9450da2cd423303d6a14a6e29f + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file diff --git a/iblutil/__init__.py b/iblutil/__init__.py index 56dbcc9..4ded0a3 100644 --- a/iblutil/__init__.py +++ b/iblutil/__init__.py @@ -1 +1 @@ -__version__ = "1.3.2" \ No newline at end of file +__version__ = "1.3.3" \ No newline at end of file diff --git a/setup.py b/setup.py index 5139575..853dcc0 100644 --- a/setup.py +++ b/setup.py @@ -1,25 +1,27 @@ -from setuptools import setup, find_packages import sys from pathlib import Path +from setuptools import setup, find_packages + CURRENT_DIRECTORY = Path(__file__).parent.absolute() CURRENT_PYTHON = sys.version_info[:2] REQUIRED_PYTHON = (3, 8) -if CURRENT_PYTHON < REQUIRED_PYTHON: - sys.stderr.write(""" +VER_ERR_MSG = """ ========================== Unsupported Python version ========================== This version of iblutil requires Python {}.{}, but you're trying to install it on Python {}.{}. -""".format(*(REQUIRED_PYTHON + CURRENT_PYTHON))) +""" +if CURRENT_PYTHON < REQUIRED_PYTHON: + sys.stderr.write(VER_ERR_MSG.format(*REQUIRED_PYTHON + CURRENT_PYTHON)) sys.exit(1) -with open('README.md', 'r') as f: +with open("README.md", "r") as f: long_description = f.read() -with open('requirements.txt') as f: +with open("requirements.txt") as f: require = [x.strip() for x in f.readlines() if not x.startswith('git+')]