diff --git a/.github/workflows/release-pypi.yml b/.github/workflows/release-pypi.yml index b0041a25..f9f5aa78 100644 --- a/.github/workflows/release-pypi.yml +++ b/.github/workflows/release-pypi.yml @@ -16,7 +16,6 @@ on: # Trigger the workflow on push or pull request, but only for the main branch jobs: build: runs-on: ubuntu-22.04 - steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 @@ -34,18 +33,41 @@ jobs: - name: Check package run: twine check dist/* --strict - # We do this, since failures on test.pypi aren't that bad - # - name: Publish to Test PyPI - # if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' - # uses: pypa/gh-action-pypi-publish@v1.10.0 - # with: - # user: __token__ - # password: ${{ secrets.test_pypi_password }} - # repository_url: https://test.pypi.org/legacy/ + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: pypi-packages-${{ github.sha }} + path: dist + + upload-release-assets: + needs: build + if: github.event_name == 'release' + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: pypi-packages-${{ github.sha }} + path: dist + - run: ls -lh dist/ + - name: Upload to release + uses: AButler/upload-release-assets@34491005a5d7ec239a784e460807ce844fde7962 # v4.0.0 + with: + files: "dist/*" + repo-token: ${{ secrets.GITHUB_TOKEN }} + + publish-pypi: + needs: build + if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + id-token: write + steps: + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: pypi-packages-${{ github.sha }} + path: dist + - run: ls -lh dist/ - name: Publish distribution 📦 to PyPI - if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 - with: - user: __token__ - password: ${{ secrets.pypi_password }}