From be961cefa875626f7d8d4d9e717fb5da1d52dde7 Mon Sep 17 00:00:00 2001 From: Alexandre Muller Date: Mon, 8 Jan 2024 09:51:19 +0100 Subject: [PATCH] github: add workflow to publish on PyPI --- .github/workflows/publish-to-pipy.yml | 50 +++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/publish-to-pipy.yml diff --git a/.github/workflows/publish-to-pipy.yml b/.github/workflows/publish-to-pipy.yml new file mode 100644 index 0000000..9ab2a18 --- /dev/null +++ b/.github/workflows/publish-to-pipy.yml @@ -0,0 +1,50 @@ +name: Publish Python distribution to PyPI + +on: push + +jobs: + build: + name: Build distribution + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.12" + - 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@v3 + 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/xlsx_streaming + 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