Configure PyPI trusted publishing for CI releases
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 68/100
调研方向
首先检查 .github/workflows/ci.yml 中的 publish 作业以及 PyPI Trusted Publishers 文档。在 PyPI 上注册仓库 hardbyte/python-meridian-energy 和 ci.yml 工作流,然后进行一次补丁版发布或仅包含文档更改的发布,以验证该作业无需 API token secrets 即可成功发布。
由索引模型根据 Issue 内容生成。
描述
Context
meridian-energy 0.1.4 was published manually via twine + ~/.pypirc.
CI already has a release publish job (.github/workflows/ci.yml) using pypa/gh-action-pypi-publish with id-token: write, but PyPI trusted publishing is not wired up yet — so the job will fail until a publisher is registered.
Goal
Publishing a GitHub Release (vX.Y.Z) should upload to PyPI with no long-lived API token in GitHub secrets or local .pypirc.
Steps
- On PyPI → meridian-energy → Publishing:
- Add a new pending publisher (Trusted Publisher → GitHub)
- Owner:
hardbyte - Repository:
python-meridian-energy - Workflow:
ci.yml(must match the filename under.github/workflows/) - Environment: leave empty unless we add a GitHub Environment
- Confirm the workflow
publishjob:permissions: id-token: write- runs only on
release: types: [published] - uses
pypa/gh-action-pypi-publish
- Optional hardening (match
python-evnexif desired):- GitHub Environment
pypiwith required reviewers attestations: write+ artifact attestationuvx twine check --strict dist/*before upload
- GitHub Environment
- Smoke test: cut a patch release (e.g. empty bump or docs-only
0.1.5) and confirm the publish job goes green without secrets.
Acceptance
- Trusted publisher configured on PyPI for this repo/workflow
- Next GitHub Release publishes to PyPI automatically
- No PyPI API token stored in GitHub Actions secrets for this repo
Refs
- https://docs.pypi.org/trusted-publishers/
- https://github.com/pypa/gh-action-pypi-publish
- Existing workflow:
.github/workflows/ci.yml(publishjob)
- 主要语言
- Python
- 星标
- 1
- 派生
- 1
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 69/100
anderspitman/awesome-tunneling#330 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
521xueweihan/HelloGitHub#4676 ·
-
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 18 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
pandas-dev/pandas-stubs#2155 ·
维护者通常 1 天内回复
-
essreduce
难度 2/5 1-3 小时 新手友好度 69/100
维护者通常 1 天内回复