Adding an option to `generate-ci` to use trusted publishing
I'm using trusted publishing, which means I apply essentially this patch to the generated CI file:
```diff
diff --git a/.github/workflows/maturin_ci.yml b/.github/workflows/maturin_ci.yml
index 01ee066..89f93b9 100644
--- a/.github/workflows/maturin_ci.yml
+++ b/.github/workflows/maturin_ci.yml
@@ -263,6 +263,7 @@ jobs:
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
needs: [linux, musllinux, windows, macos, sdist]
+ environment: release
permissions:
# Use to sign the release artifacts
id-token: write
@@ -275,6 +276,4 @@ jobs:
uses: astral-sh/setup-uv@v7
- name: Publish to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') }}
- run: uv publish 'wheels-*/*'
- env:
- UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
+ run: uv publish --trusted-publishing always 'wheels-*/*'
```
Setting the environment is optional but recommended.
I would like to have a setting for this, looking something like this:
```toml
[tool.maturin.generate-ci.github]
trusted-publishing = true
publishing-environment = "release"
```
Would you be interested in that? I'd be happy to send a PR.
关闭于 2026-05-07 1 条评论