From c673c092dc3c83d06c761ce25600001cd0c2ff44 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Tue, 29 Mar 2022 13:35:06 +0200 Subject: [PATCH] py: Update the PyPI job to use poetry and correct versions Let's use poetry when we already use it for everything else. Changelog-None --- .github/workflows/pypi.yml | 36 +++++++++++++++-------------- contrib/pyln-client/pyproject.toml | 1 + contrib/pyln-proto/pyproject.toml | 1 + contrib/pyln-testing/pyproject.toml | 1 + 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 6e0882547..b6c0bd1f1 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -38,35 +38,37 @@ jobs: with: python-version: 3.7 - - name: Install pypa/build + - name: Install pypa/build and poetry run: >- - python -m pip install build --user + python -m pip install build poetry --user - name: Build a binary wheel and a source tarball env: WORKDIR: ${{ matrix.WORKDIR }} - run: >- - cd ${{ env.WORKDIR}} && - python -m build --sdist --wheel --outdir dist/ . + run: | + export VERSION=$(git describe --abbrev=0).post$(git describe --abbrev=1 | awk -F "-" '{print $2}') + cd ${{ env.WORKDIR}} + poetry version $VERSION + poetry build - name: Publish distribution 📦 to Test PyPI if: github.repository == 'ElementsProject/lightning' - uses: pypa/gh-action-pypi-publish@master env: + POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.TEST_PYPI_API_TOKEN }} WORKDIR: ${{ matrix.WORKDIR }} - with: - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ - packages_dir: "${{ env.WORKDIR}}/dist" - skip_existing: true + run: | + cd ${{ env.WORKDIR}} + poetry config repositories.testpypi https://test.pypi.org/legacy/ + poetry publish --repository testpypi --no-interaction - name: Publish distribution 📦 to PyPI if: startsWith(github.ref, 'refs/tags') && github.repository == 'ElementsProject/lightning' - uses: pypa/gh-action-pypi-publish@master env: + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} WORKDIR: ${{ matrix.WORKDIR }} - with: - password: ${{ secrets.PYPI_API_TOKEN }} - packages_dir: "${{ env.WORKDIR}}/dist" - # We should never have a conflict here, the version tags are unique - skip_existing: false + run: | + cd ${{ env.WORKDIR}} + export VERSION=$(git describe --abbrev=0) + poetry version $VERSION + poetry config repositories.testpypi https://test.pypi.org/legacy/ + poetry publish --repository testpypi --no-interaction diff --git a/contrib/pyln-client/pyproject.toml b/contrib/pyln-client/pyproject.toml index 3014e19d7..1b4bac179 100644 --- a/contrib/pyln-client/pyproject.toml +++ b/contrib/pyln-client/pyproject.toml @@ -4,6 +4,7 @@ version = "0.10.2.post1" description = "Client library and plugin library for c-lightning" authors = ["Christian Decker "] license = "BSD-MIT" +readme = "README.md" packages = [ { include = "pyln/client" }, diff --git a/contrib/pyln-proto/pyproject.toml b/contrib/pyln-proto/pyproject.toml index cdc074d85..c31c5ad4f 100644 --- a/contrib/pyln-proto/pyproject.toml +++ b/contrib/pyln-proto/pyproject.toml @@ -4,6 +4,7 @@ version = "0.10.2.post1" description = "This package implements some of the Lightning Network protocol in pure python. It is intended for protocol testing and some minor tooling only. It is not deemed secure enough to handle any amount of real funds (you have been warned!)." authors = ["Christian Decker "] license = "BSD-MIT" +readme = "README.md" packages = [ { include = "pyln/proto" }, diff --git a/contrib/pyln-testing/pyproject.toml b/contrib/pyln-testing/pyproject.toml index c9a319455..6d9f9e569 100644 --- a/contrib/pyln-testing/pyproject.toml +++ b/contrib/pyln-testing/pyproject.toml @@ -4,6 +4,7 @@ version = "0.10.2" description = "Test your c-lightning integration, plugins or whatever you want" authors = ["Christian Decker "] license = "BSD-MIT" +readme = "README.md" packages = [ { include = "pyln/testing" },