From acb01b648cc3d29c078fb38b9aaffb08953259fa Mon Sep 17 00:00:00 2001 From: Cody Hart Date: Mon, 8 Dec 2025 10:47:02 -0500 Subject: [PATCH] add publish workflow --- .github/workflows/publish.yml | 38 +++++++++++++++++++++++++++++++++++ MANIFEST.in | 6 ++++++ pyproject.toml | 24 +++++++++++++++++----- 3 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..bc09411 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,38 @@ +name: Publish to PyPI + +on: + release: + types: [created] + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write # Required for trusted publishing (recommended) + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: 'pip' + + - name: Install build tools + run: | + python -m pip install --upgrade pip + pip install build twine + + - name: Build package + run: python -m build + + - name: Check package + run: twine check dist/* + + - name: Publish to PyPI + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: twine upload dist/* diff --git a/MANIFEST.in b/MANIFEST.in index 8ca4676..955822a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,7 +4,13 @@ include CONTRIBUTING.md include CHANGELOG.md include pyproject.toml recursive-include django_rewind *.py +recursive-exclude django_rewind/tests * recursive-include django_rewind/migrations *.py recursive-include django_rewind/templates * global-exclude __pycache__ global-exclude *.py[co] +global-exclude .git* +global-exclude test_project +global-exclude *.egg-info +global-exclude dist +global-exclude build diff --git a/pyproject.toml b/pyproject.toml index b1eeebe..6674f41 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -110,11 +110,25 @@ packages = ["django_rewind"] [tool.hatch.build.targets.sdist] include = [ - "/django_rewind", - "/README.md", - "/LICENSE", - "/CONTRIBUTING.md", - "/CHANGELOG.md", + "django_rewind", + "README.md", + "LICENSE", + "CONTRIBUTING.md", + "CHANGELOG.md", +] +exclude = [ + "django_rewind/tests", + "test_project", + "*.pyc", + "__pycache__", + ".git", + ".github", + ".pytest_cache", + ".mypy_cache", + ".tox", + "dist", + "build", + "*.egg-info", ] [tool.black]