diff options
author | Christian Heimes <christian@python.org> | 2022-07-14 11:58:10 +0200 |
---|---|---|
committer | Christian Heimes <christian@python.org> | 2022-07-14 12:16:14 +0200 |
commit | 041aa121234936f4f7c225e92c43d622769c12e3 (patch) | |
tree | d87a894dcdf72b4f057f5349342698814caad7b2 /.github | |
parent | 6c7a8ed9b7d3cf871ae5ff72e76e4d2e2297c74d (diff) | |
download | defusedxml-git-041aa121234936f4f7c225e92c43d622769c12e3.tar.gz |
Add pypi workflow
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/main.yml | 5 | ||||
-rw-r--r-- | .github/workflows/pypi.yml | 64 |
2 files changed, 67 insertions, 2 deletions
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 |