|
1 | | -name: CI workflow for python projects |
| 1 | +name: CI workflow |
2 | 2 |
|
3 | 3 | # Run the CI test workflow of jobs which includes: |
4 | 4 | # - `test`: Run tests (including code checks) using `tox`. |
5 | 5 | # - `build`: Build the python package. |
6 | 6 | # - `publish-test`: Publish the package to test.pypi.org. |
7 | 7 | # - `publish`: Publish the package to pypi.org (runs `publish-test`). |
8 | 8 | # - `release`: Create a GitHub release. |
| 9 | +# |
| 10 | +# Requirements for trusted publishing of python packages to pypi.org: |
| 11 | +# 1. For trusted publishing, the publishing workflow must be in the project |
| 12 | +# repository, so copy this workflow file to `.github/workflows/ci.yaml` |
| 13 | +# in your repository. |
| 14 | +# 2. Create a github Environment in your repo called `publish-pypi` |
| 15 | +# (Settings->Environments->New Environment) (Optional). |
| 16 | +# 3. Add the name of this workflow file (ci.yaml) as a "trusted |
| 17 | +# publisher" on your pypi and test.pypi project pages (add the name of the |
| 18 | +# relevant Environment for additional access control). |
| 19 | +# 4. Call this workflow from a parent workflow with the `pypi` input set to |
| 20 | +# "upload.pypi" or "test.pypi" (default). |
| 21 | + |
9 | 22 |
|
10 | 23 | # Configure the workflows here. Each environment variable name should be a |
11 | 24 | # wildcard matching the |
|
27 | 40 | jobs=["test", "build"] |
28 | 41 | python-version=["3.9", "3.13"] |
29 | 42 | os=["ubuntu-latest"] |
30 | | - on-workflow_dispatch-*: | # Manual trigger of the workflow |
| 43 | + on-workflow_dispatch-branch-*: | # Manual trigger of the workflow |
31 | 44 | jobs=["test", "build"] |
32 | 45 | python-version=["3.9", "3.13"] |
33 | 46 | os=["ubuntu-latest"] |
|
36 | 49 | push: |
37 | 50 | branches: ["**"] # Push commits to any branch |
38 | 51 | tags: ["v[0-9]*"] # Publish on tags matching "v*", eg. "v1.0.0" |
| 52 | + |
| 53 | +####### Edit above this line - leave the rest of the workflow intact. |
| 54 | + |
39 | 55 | workflow_dispatch: # Allow manual triggering of the workflow |
40 | 56 |
|
41 | 57 | jobs: |
|
0 commit comments