From e05e66a28b28ca3aa8a59825316bd4ac1c4fb572 Mon Sep 17 00:00:00 2001 From: sbilge Date: Wed, 11 Dec 2024 17:05:01 +0100 Subject: [PATCH] update pypi publish workflow (#38) * update pypi publish workflow --- .github/workflows/pypi_publish.yaml | 78 +++-------------------------- 1 file changed, 8 insertions(+), 70 deletions(-) diff --git a/.github/workflows/pypi_publish.yaml b/.github/workflows/pypi_publish.yaml index e747cfb..cc950d1 100644 --- a/.github/workflows/pypi_publish.yaml +++ b/.github/workflows/pypi_publish.yaml @@ -1,74 +1,12 @@ -name: PyPI Publish - +name: Call PyPI publish workflow on: release: types: [published] - jobs: - pypi-publish: - name: Publish tagged release on PyPI - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Python 3.9 - uses: actions/setup-python@v4 - with: - python-version: "3.9" - - - name: Ensure package version and tag are equal - run: | - - PKG_VER="$(grep -oP '^version = "\K[^"]+' pyproject.toml)" - TAG_VER="${GITHUB_REF##*/}" - - echo "Package version is $PKG_VER" >&2 - echo "Tag version is $TAG_VER" >&2 - if [ "$PKG_VER" != "$TAG_VER" ]; then - echo "Package version and tag name mismatch." >&2 - exit 1 - fi - - - name: Install pypa/build - run: >- - python -m - pip install - build - --user - - - name: Build a binary wheel and a source tarball - run: >- - python -m - build - --sdist - --wheel - --outdir dist/ - . - - - name: Install the newly built package with all extras - run: | - TAR_PATH="$( realpath ./dist/*.tar.gz)" - python -m \ - pip install \ - "${TAR_PATH}[all]" - - - name: Install testing requirements - run: >- - python -m - pip install - --no-deps -r ./lock/requirements-dev.txt - - - name: Run pytest on freshly installed package - run: | - pytest . - - - name: Publish distribution package to PyPI (test) - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository-url: https://test.pypi.org/legacy/ - - - name: Publish distribution package to PyPI (production) - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} + call-pypi-publish: + uses: ghga-de/gh-action-pypi/.github/workflows/pypi_publish.yml@v2.0.0 + with: + package_version: 2.0.0-alpha.5 + test_pypi: "false" + python_latest: true + secrets: inherit