Skip to content

Commit

Permalink
Add pypi workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tiran committed Jul 14, 2022
1 parent 6c7a8ed commit 041aa12
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion defusedxml/expatreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DefusedExpatParser(_ExpatParser):
def __init__(
self,
namespaceHandling=0,
bufsize=2 ** 16 - 20,
bufsize=2**16 - 20,
forbid_dtd=False,
forbid_entities=True,
forbid_external=True,
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def run(self):
license="PSFL",
description="XML bomb protection for Python stdlib modules",
long_description="\n".join(long_description),
long_description_content_type="text/x-rst",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand All @@ -57,6 +58,7 @@ def run(self):
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Text Processing :: Markup :: XML",
],
python_requires=">=3.6",
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py36,py37,py38,py39,py310,black,pep8py3,doc
envlist = py36,py37,py38,py39,py310,py311,black,pep8py3,doc
skip_missing_interpreters = true

[testenv]
Expand Down

0 comments on commit 041aa12

Please sign in to comment.