From a7ed78b786456b76e8cef77fca8c290ede6923f7 Mon Sep 17 00:00:00 2001 From: martin-springer Date: Wed, 21 Aug 2024 09:02:39 -0400 Subject: [PATCH 1/2] replace deploy with trusted publisher --- .github/workflows/deploy.yaml | 33 ----------------- .github/workflows/publish-to-pypi.yaml | 50 ++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 33 deletions(-) delete mode 100644 .github/workflows/deploy.yaml create mode 100644 .github/workflows/publish-to-pypi.yaml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml deleted file mode 100644 index 05750cd46..000000000 --- a/.github/workflows/deploy.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: Deploy Python Package - -on: - release: - types: [published] - -jobs: - deploy: - name: Deploy to PyPI - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.8' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* - - uses: actions/upload-artifact@v2 - with: - name: dist - path: | - dist/* diff --git a/.github/workflows/publish-to-pypi.yaml b/.github/workflows/publish-to-pypi.yaml new file mode 100644 index 000000000..57d938ed4 --- /dev/null +++ b/.github/workflows/publish-to-pypi.yaml @@ -0,0 +1,50 @@ +name: Publish Python distribution to PyPI and TestPyPI + +on: push + +jobs: + build: + name: Build distribution + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: >- + Publish Python distribution to PyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/rdtools + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file From bcf8eede09ca3ed0f9d1e4874d2be986e6df8cc9 Mon Sep 17 00:00:00 2001 From: martin-springer Date: Wed, 21 Aug 2024 09:12:40 -0400 Subject: [PATCH 2/2] update changelog --- docs/sphinx/source/changelog/pending.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/sphinx/source/changelog/pending.rst b/docs/sphinx/source/changelog/pending.rst index c1ef09d29..f6f4e25b0 100644 --- a/docs/sphinx/source/changelog/pending.rst +++ b/docs/sphinx/source/changelog/pending.rst @@ -23,6 +23,7 @@ Enhancements Bug fixes --------- * Fix typos in citation section of the readme file (:issue:`414`, :pull:`421`) +* Fix deploy workflow to pypi (:issue:`416`, :pull:`427`) Requirements ------------