From 041aa121234936f4f7c225e92c43d622769c12e3 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 14 Jul 2022 11:58:10 +0200 Subject: Add pypi workflow --- .github/workflows/main.yml | 5 ++-- .github/workflows/pypi.yml | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/pypi.yml (limited to '.github') diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1791bb8..f575328 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,9 +24,10 @@ jobs: - "3.8" - "3.9" - "3.10" + - "3.11-dev" steps: - - uses: "actions/checkout@v2" - - uses: "actions/setup-python@v2" + - uses: "actions/checkout@v3" + - uses: "actions/setup-python@v4" with: python-version: "${{ matrix.python-version }}" - name: "Update pip" diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..296e64b --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,64 @@ +--- +name: Build and upload to PyPI + +permissions: + contents: read + +on: + workflow_dispatch: + inputs: + tag: + description: tag to build + required: true + type: string + testpypi: + description: upload to Test PyPI + type: boolean + default: false + pypi: + description: upload to PyPI + type: boolean + default: false + push: + branches: + - master + - main + - v*.x + pull_request: + branches: + - master + - main + - v*.x + +jobs: + pypi: + name: Build and upload to PyPI + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: ${{ github.event.inputs.tag || github.ref }} + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: "Update pip" + run: python -m pip install --upgrade pip setuptools wheel + - name: "Install 'build' and 'twine'" + run: python -m pip install --upgrade build twine + - name: "Run 'build'" + run: "python -m build" + - name: "Run twine check" + run: "python -m twine check dist/*" + - name: Publish distribution to Test PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + if: github.event.inputs.testpypi == true + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_API_TOKEN }} + if: github.event.inputs.pypi == true -- cgit v1.2.1