From c2ab984acccd0cec67bcc8449d15bf77d08ed16f Mon Sep 17 00:00:00 2001 From: Joss Moffatt Date: Mon, 13 Nov 2023 11:03:50 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Fixing=20pypi=20deploy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yaml | 59 +++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 47cdd75..1e7971c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -25,4 +25,61 @@ jobs: uses: actions/upload-artifact@v3 with: name: python-package-distributions - path: dist/ \ No newline at end of file + 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/bookshelf-cli + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: 📥 Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: 🚀 Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + github-release: + name: >- + ✒️ Sign the Python 🐍 distribution 📦 with Sigstore + and upload them to GitHub Release + needs: + - publish-to-pypi + runs-on: ubuntu-latest + + permissions: + contents: write # IMPORTANT: mandatory for making GitHub Releases + id-token: write # IMPORTANT: mandatory for sigstore + + steps: + - name: 📥 Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: ✒️ Sign the dists with Sigstore + uses: sigstore/gh-action-sigstore-python@v1.2.3 + with: + inputs: >- + ./dist/*.tar.gz + ./dist/*.whl + - name: 🏷️ Upload artifact signatures to GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + # Upload to GitHub Release using the `gh` CLI. + # `dist/` contains the built packages, and the + # sigstore-produced signatures and certificates. + run: >- + gh release upload + '${{ github.ref_name }}' dist/** + --repo '${{ github.repository }}'