From 714b0f5bbe42f678bf544c317bbf5f52065db257 Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Tue, 19 Mar 2024 21:02:51 +0000 Subject: [PATCH] add pypi publishing --- .github/workflows/_pypi.yml | 22 ++++++++++++++++++++++ .github/workflows/ci.yml | 9 +++++++++ 2 files changed, 31 insertions(+) create mode 100644 .github/workflows/_pypi.yml diff --git a/.github/workflows/_pypi.yml b/.github/workflows/_pypi.yml new file mode 100644 index 0000000..f2ead1b --- /dev/null +++ b/.github/workflows/_pypi.yml @@ -0,0 +1,22 @@ +on: + workflow_call: + secrets: + PYPI_TOKEN: + required: true + +jobs: + upload: + runs-on: ubuntu-latest + environment: release + + steps: + - name: Download dist artifact + uses: actions/download-artifact@v4 + with: + name: dist + path: dist + + - name: Publish to PyPI using trusted publishing + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71cc4a7..c29dad2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,15 @@ jobs: if: needs.check.outputs.branch-pr == '' uses: ./.github/workflows/_dist.yml + pypi: + if: github.ref_type == 'tag' + needs: dist + uses: ./.github/workflows/_pypi.yml + permissions: + id-token: write + secrets: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + release: if: github.ref_type == 'tag' needs: [dist]