Configure PyPI trusted publishing for CI releases

未关闭
#1 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
冷清
技术栈
github-actions, python
领域
ci-cd, devops, release

调研方向

首先检查 .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

  1. 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
  2. Confirm the workflow publish job:
    • permissions: id-token: write
    • runs only on release: types: [published]
    • uses pypa/gh-action-pypi-publish
  3. Optional hardening (match python-evnex if desired):
    • GitHub Environment pypi with required reviewers
    • attestations: write + artifact attestation
    • uvx twine check --strict dist/* before upload
  4. 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

主要语言
Python
星标
1
派生
1
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。