|
1 |
| -# Publishing to PyPI |
2 |
| - |
3 |
| -The release.yml workflow in this directory depends on you having |
4 |
| -already setup a project on the [Python Package Index][pypi] and [added |
5 |
| -a trusted publisher][trusted-publisher]. The workflow depends on an |
6 |
| -environment named "pypi" which must agree with the environment named |
7 |
| -when adding the trusted publisher. It doesn't have to be named `pypi` |
8 |
| -it just needs to match in both places. Additionally, the project name |
9 |
| -on PyPI should match `cookiecutter.package_name` or modify release.yml |
10 |
| -to ensure `environment.url` matches the PyPI project URL. |
11 |
| - |
12 |
| -## Testing |
13 |
| - |
14 |
| -The release workflow has two stages: |
15 |
| -- test |
16 |
| -- publish |
17 |
| - |
18 |
| -The test stage utilizes the `matrix` feature to test against a variety |
19 |
| -of operating systems and python versions. This is likely more testing |
20 |
| -than you might require, reduce the `os` and `python_versions` lists |
21 |
| -to suit your needs. |
22 |
| - |
23 |
| -Tests are initiated when a tag formatted as a [semantic |
24 |
| -version][semantic-version] is detected or with the suffix `-test` is |
25 |
| -detected. |
26 |
| - |
27 |
| -The publish stage depends on all the tests finishing successfully |
28 |
| -before continuing. The package will be built in a Linux container |
29 |
| -and uses [uv][uv] for the build and is published to PyPI on success. |
| 1 | +# GitHub Actions Workflows |
| 2 | + |
| 3 | +This directory contains GitHub Actions workflows for automated testing, building, publishing, and documentation deployment. |
| 4 | + |
| 5 | +## Workflows Overview |
| 6 | + |
| 7 | +### release.yaml - Test, Publish and Release |
| 8 | + |
| 9 | +A comprehensive CI/CD pipeline with the following stages: |
| 10 | +1. **get-python-versions** - Dynamically extract Python test versions from `pyproject.toml` |
| 11 | +2. **test** - Run tests across multiple OS and Python versions |
| 12 | +3. **build** - Build package artifacts |
| 13 | +4. **publish** - Publish to PyPI |
| 14 | +5. **github-release** - Create GitHub release with auto-generated changelog |
| 15 | +6. **deploy-docs** - Trigger documentation deployment |
| 16 | + |
| 17 | +### docs.yml - Deploy Documentation |
| 18 | + |
| 19 | +Builds and deploys MkDocs documentation to GitHub Pages, triggered by: |
| 20 | +- Repository dispatch events from release workflow |
| 21 | +- Manual workflow dispatch |
| 22 | + |
| 23 | +## Publishing to PyPI |
| 24 | + |
| 25 | +The release workflow depends on you having already setup a project on the [Python Package Index][pypi] and [added a trusted publisher][trusted-publisher]. The workflow depends on an environment named "pypi" which must agree with the environment named when adding the trusted publisher. Additionally, the project name on PyPI should match `cookiecutter.package_name` or modify release.yaml to ensure `environment.url` matches the PyPI project URL. |
| 26 | + |
| 27 | +## Testing Configuration |
| 28 | + |
| 29 | +### Dynamic Python Version Detection |
| 30 | + |
| 31 | +The workflow automatically detects Python test versions from your `pyproject.toml`: |
| 32 | + |
| 33 | +```toml |
| 34 | +[tool.{{ cookiecutter.package_name }}.ci] |
| 35 | +test-python-versions = ["3.11", "3.12", "3.13"] |
| 36 | +``` |
| 37 | + |
| 38 | +If not found, falls back to cookiecutter template defaults. |
| 39 | + |
| 40 | +### Matrix Testing |
| 41 | + |
| 42 | +The test stage utilizes the `matrix` feature to test against: |
| 43 | +- Multiple operating systems (configurable via cookiecutter) |
| 44 | +- Multiple Python versions (dynamic or fallback) |
| 45 | + |
| 46 | +Reduce the `os` and `python_versions` lists in cookiecutter.json to suit your needs. |
| 47 | + |
| 48 | +### Triggers |
| 49 | + |
| 50 | +Tests are initiated when: |
| 51 | +- A tag formatted as a [semantic version][semantic-version] is detected |
| 52 | +- A tag with `-test` suffix is detected (for testing releases) |
| 53 | +- Manual workflow dispatch |
| 54 | + |
| 55 | +## Build and Deployment Process |
| 56 | + |
| 57 | +1. **Testing**: All tests must pass before proceeding |
| 58 | +2. **Build**: Package is built using [uv][uv] and artifacts are stored |
| 59 | +3. **Publish**: Artifacts are published to PyPI using trusted publishing |
| 60 | +4. **Release**: GitHub release is created with auto-generated changelog |
| 61 | +5. **Documentation**: Docs deployment is triggered automatically |
| 62 | + |
| 63 | +## Changelog and Release Notes |
| 64 | + |
| 65 | +The workflow includes automatic changelog generation using: |
| 66 | +- **BobAnkh/auto-generate-changelog** action for structured changelog updates |
| 67 | +- **Git log analysis** for commit-based release notes |
| 68 | +- **CHANGELOG.md integration** when available |
| 69 | + |
| 70 | +## Documentation Deployment |
| 71 | + |
| 72 | +The docs workflow: |
| 73 | +- **Auto-enables GitHub Pages** if not already configured |
| 74 | +- **Builds MkDocs documentation** with strict mode |
| 75 | +- **Deploys to GitHub Pages** using artifact upload/download pattern |
| 76 | +- **Triggered automatically** after successful releases via repository dispatch |
30 | 77 |
|
31 | 78 | ## Tricksy Jinja Formatting
|
32 | 79 |
|
|
0 commit comments