From 4826afdac0ce7a9b033a645e0de91db7ab6f52a1 Mon Sep 17 00:00:00 2001 From: Lucas de Sousa Rosa Date: Thu, 23 Nov 2023 22:17:06 -0300 Subject: [PATCH] Update publish action to support version bump --- .github/workflows/pypi-publish.yml | 30 ++++++++++++++++++++++-------- pipreqs/__init__.py | 2 +- pyproject.toml | 6 ++++-- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index eabffa5..1909a32 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -1,14 +1,28 @@ -name: Python package +name: Deploy to PyPI + on: release: - types: [published] + types: [created] + jobs: - build_and_publish: + deploy: runs-on: ubuntu-latest + env: + POETRY_VIRTUALENVS_CREATE: "false" steps: - uses: actions/checkout@v3 - - name: Build and publish to pypi - uses: JRubics/poetry-publish@v1.17 - with: - pypi_token: ${{ secrets.PYPI_TOKEN }} - ignore_dev_requirements: "yes" \ No newline at end of file + + - name: Install poetry with bumpversion plugin + run: | + pipx install poetry + pipx inject poetry poetry-bumpversion + + - name: Build the package and bump version + run: | + poetry version ${{ github.ref_name }} + poetry build + + - name: Publish to PyPI + run: | + poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} + poetry publish --repository test-pypi \ No newline at end of file diff --git a/pipreqs/__init__.py b/pipreqs/__init__.py index d163f29..f0b4bf0 100755 --- a/pipreqs/__init__.py +++ b/pipreqs/__init__.py @@ -1,3 +1,3 @@ __author__ = 'Vadim Kravcenko' __email__ = 'vadim.kravcenko@gmail.com' -__version__ = '0.4.13' +__version__ = '0.4.19' diff --git a/pyproject.toml b/pyproject.toml index 123f4df..a74a1fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] -name = "pipreqs" -version = "0.4.13" +name = "pipreqs-build-test" +version = "0.4.19" description = "Pip requirements.txt generator based on imports in project" authors = ["Vadim Kravcenko "] license = "Apache-2.0" @@ -34,6 +34,8 @@ tox = "^4.11.3" coverage = "^7.3.2" sphinx = { version = "^7.2.6", python = ">=3.9" } +[tool.poetry_bumpversion.file."pipreqs/__init__.py"] + [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" \ No newline at end of file