Skip to content

ci: Add automated testing matrix and PyPI Trusted Publishing release workflows - #2

Open
jeremylanes wants to merge 3 commits into
ProKelly:masterfrom
jeremylanes:master
Open

ci: Add automated testing matrix and PyPI Trusted Publishing release workflows#2
jeremylanes wants to merge 3 commits into
ProKelly:masterfrom
jeremylanes:master

Conversation

@jeremylanes

Copy link
Copy Markdown
Contributor

Summary

This PR sets up the continuous integration (CI) and automated continuous deployment (CD) workflows for django-alpine using GitHub Actions:

  1. Automated Testing Matrix (.github/workflows/test.yml):

    • Runs ./bin/test.sh on every push and pull request across Python 3.10, 3.11, 3.12, 3.13, and 3.14-dev paired with Django 4.2 LTS, 5.0, and 5.1.
    • Uses pip caching for fast execution.
  2. Automated PyPI Deployment (.github/workflows/publish.yml):

    • Builds both sdist (.tar.gz) and wheel (.whl) distributions cleanly.
    • Runs twine check --strict before publication to guarantee package validity.
    • Publishes to PyPI automatically upon creating a GitHub Release using PyPI Trusted Publishing (OIDC) (no long-lived API tokens or secret keys required).

🛠️ One-Time Setup for PyPI Trusted Publishing (For @ProKelly)

To enable automated deployment from this repository to PyPI, follow these 3 quick steps:

Step 1: Add GitHub as a Trusted Publisher on PyPI

  1. Log in to PyPI.org and navigate to your project settings:
    👉 https://pypi.org/manage/project/django-alpine/settings/publishing/
  2. In the "Add a publisher" section, fill in:
    • Publisher: GitHub
    • Owner: ProKelly
    • Repository name: django-alpine
    • Workflow name: publish.yml
    • Environment name: (leave empty)
  3. Click Add publisher.

Step 2: Trigger the First Release (v0.2.0)

Whenever you want to release a new version to PyPI:

  1. Merge this PR into main.
  2. Go to Releases on GitHub: https://github.com/ProKelly/django-alpine/releases/new
  3. Click "Choose a tag", type v0.2.0, and select Create new tag: v0.2.0 on publish.
  4. Set the Release Title (e.g., django-alpine 0.2.0) and click "Publish release".

GitHub Actions will automatically run publish.yml, verify the package, and upload django-alpine 0.2.0 directly to PyPI!


Verification

  • Package build tested with python -m build (generates valid .tar.gz and .whl).
  • Verified metadata and license with twine check --strict dist/* (PASSED).
  • Full test suite passing (25 unit tests).

@jeremylanes

Copy link
Copy Markdown
Contributor Author

ci: Add GitHub Actions CI/CD workflows and Commitizen automated release setup

Summary

This PR sets up continuous integration (CI) and automated continuous deployment (CD) workflows for django-alpine using GitHub Actions and Commitizen
(cz):

  1. Automated Testing Matrix (.github/workflows/test.yml):

    • Runs ./bin/test.sh on every push and pull request across Python 3.10, 3.11, 3.12, 3.13, and 3.14-dev paired with Django 4.2 LTS, 5.0,
      and 5.1.
    • Uses pip caching for fast execution.
  2. Automated PyPI Deployment (.github/workflows/publish.yml):

    • Builds both sdist (.tar.gz) and wheel (.whl) distributions cleanly.
    • Runs twine check --strict before publication to guarantee package validity.
    • Publishes to PyPI automatically upon pushing a version tag (v*) using PyPI Trusted Publishing (OIDC) (no long-lived API tokens or secret keys
      required).
  3. Commitizen Configuration (pyproject.toml):

    • Configured [tool.commitizen] for seamless automated version bumping, changelog generation, and Git tagging.

🛠️ One-Time Setup for PyPI Trusted Publishing (For @ProKelly)

To enable automated deployment from this repository to PyPI, follow these quick steps:

Step 1: Add GitHub as a Trusted Publisher on PyPI

  1. Log in to PyPI.org and navigate to your project settings:
    👉 https://pypi.org/manage/project/django-alpine/settings/publishing/
  2. In the "Add a publisher" section, fill in:
    • Publisher: GitHub
    • Owner: ProKelly
    • Repository name: django-alpine
    • Workflow name: publish.yml
    • Environment name: (leave empty)
  3. Click Add publisher.

Step 2: Automated Release with Commitizen (cz bump)

Initial Release (v0.2.0)

After merging this PR into main, set the initial modernized release version by running:

# 1. Bump version to 0.2.0, generate CHANGELOG.md, and create Git tag
cz bump --manual-version 0.2.0

# 2. Push commit and tag to trigger the automated PyPI deployment
git push --follow-tags

#### Future Releases

# For all upcoming releases, simply follow the standard Commitizen workflow:

cz bump
git push --follow-tags

(Commitizen will automatically compute the next semver version from your commits, update pyproject.toml, update CHANGELOG.md, and create the tag. GitHub
Actions will then automatically publish to PyPI).

(Note: Creating a Release via the GitHub Web UI is also fully supported).


Verification

[✓] Package build tested with python -m build (generates valid .tar.gz and .whl).
[✓] Verified metadata and license with twine check --strict dist/* (PASSED).
[✓] Full test suite passing (25 unit tests).
[✓] Commitizen configuration validated with PEP 621 versioning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant