From 670d5c210e0210cbc45234c5c04f5c7254d0c425 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Thu, 25 Jan 2024 22:18:34 +0900 Subject: [PATCH] Publish package releases using the GitHub Actions (#114) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/publish-to-pypi.yml | 60 +++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/publish-to-pypi.yml diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml new file mode 100644 index 00000000..6cd94f81 --- /dev/null +++ b/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,60 @@ +name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI +on: + workflow_dispatch: + pull_request: + push: + tags: + - "*" + branches: + - main + - "release/*" +permissions: + id-token: write +jobs: + build-n-publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + - name: Install packages + run: > + sudo apt -y install + libgl1-mesa-glx + xvfb + python-tk + libglu1 + libxcursor-dev + libxft2 + libxinerama1 + libfltk1.3-dev + libfreetype6-dev + libgl1-mesa-dev + libocct-foundation-dev + libocct-data-exchange-dev + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: >- + python3 -m + build + --sdist + --wheel + --outdir dist/ + - name: Publish distribution to Test PyPI + if: contains(github.ref, 'main') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository-url: https://test.pypi.org/legacy/ + - name: Publish distribution to PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }}