Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Python Release

on:
release:
types: [published]

jobs:
test:
uses: ./.github/workflows/python-test.yml

publish:
needs: test
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/gtfs-diff-engine/
permissions:
id-token: write # Required for PyPI Trusted Publisher (OIDC)
contents: read

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install build backend
run: |
python -m pip install --upgrade pip
pip install build

- name: Build distributions
run: |
python -m build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
29 changes: 29 additions & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Python Tests

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is already covered by ci.yml

@jcpitre jcpitre Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want tests to run before release? Or do we trust that ci.yml ran properly?
python-test.yml is essentially called from python-release.yml.
It could have been embedded in python-release.yml.

  • ci.yml is a smart gate — runs conditionally on path changes, designed for PR feedback speed
  • python-test.yml is a release safety net — runs unconditionally, designed for correctness at publish time

I suggest we keep both.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure! could we support the same python versions?

@jcpitre jcpitre Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.
The rationale for the versions used in python-test.yml was that if it works with 3.13 then it must work with 3.12. But it's not guaranteed, so your comment is spot on.
I curious to know why you did not include 3.11 in the list of versions?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding at the time was that python 3.10 is still supported (security updates), but not 3.11. I just looked it up i'm completely wrong they are both in their final "security-only" support phase.


on:
workflow_call:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
# Oldest and latest supported versions — sufficient to catch compatibility issues
python-version: ["3.10", "3.12", "3.14"]

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install package
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run tests
run: python -m pytest tests/ -v
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pip install gtfs-diff-engine
For a development (editable) install with test dependencies:

```bash
git clone https://github.com/your-org/gtfs-diff-engine
git clone https://github.com/MobilityData/gtfs-diff-engine
cd gtfs-diff-engine
pip install -e ".[dev]"
```
Expand Down Expand Up @@ -240,6 +240,30 @@ pip install -e ".[dev]"
pytest tests/ -v
```

## Releasing a New Version

1. **Bump the version** in `pyproject.toml`:
```toml
[project]
version = "x.y.z"
```

2. **Commit and push** the version bump to `main`.

3. **Create a GitHub Release** via the GitHub UI (or `gh release create`):
- Set the tag to `vx.y.z` (e.g. `v0.2.0`)
- Write a release title and notes summarising changes
- Click **Publish release**

4. **The publish workflow fires automatically.** The [`Publish to PyPI`](.github/workflows/publish.yml) GitHub Actions workflow triggers on release publication, builds the package, and pushes it to PyPI via [Trusted Publisher (OIDC)](https://docs.pypi.org/trusted-publishers/) — no API token required.

5. **Verify** the new version appears on [https://pypi.org/project/gtfs-diff-engine](https://pypi.org/project/gtfs-diff-engine) and is installable:
```bash
pip install gtfs-diff-engine==x.y.z
```

> **One-time PyPI setup:** A maintainer must configure the repository as a Trusted Publisher on PyPI before the first automated release. Go to the [gtfs-diff-engine PyPI project](https://pypi.org/manage/project/gtfs-diff-engine/settings/publishing/), add a publisher for `MobilityData/gtfs-diff-engine`, workflow `publish.yml`, environment `pypi`.

## License

See [LICENSE](LICENSE).