Skip to content

ci: release 工作流挂载 dist/* 资产(根治 Release 资产为空) - #23

Merged
im47cn merged 1 commit into
mainfrom
ci/release-assets
Aug 31, 2026
Merged

im47cn merged 1 commit into
mainfrom
ci/release-assets

Conversation

@im47cn-bot

@im47cn-bot im47cn-bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

变更

release.yml 的 Create GitHub Release 步骤原先 gh release create 不带文件参数,GitHub Release 条目永远没有二进制归档(v0.1.7 实测资产为空,已手动补挂)。

-gh release view "$GITHUB_REF_NAME" ... >/dev/null 2>&1 \
-  || gh release create "$GITHUB_REF_NAME" ... --generate-notes
+if gh release view ...; then
+  gh release upload "$GITHUB_REF_NAME" dist/* --clobber
+else
+  gh release create "$GITHUB_REF_NAME" ... --generate-notes dist/*
+fi
  • 创建即挂 dist/*(sdist + wheel,二进制归档语义)
  • 已存在(workflow 重跑)走 upload --clobber 幂等补传,不重复建条目

验证

  • YAML 语法校验通过
  • 行为路径与 v0.1.7 手动补挂命令同构(gh release upload TAG dist/*)
  • 仅 workflow 改动,无代码/测试影响;下次发版(v0.1.8+)自动生效

Sourcery 总结

将构建的分发归档文件附加到 GitHub Releases,并在工作流重新运行时可靠地恢复资源。

错误修复:

  • 确保 GitHub Releases 包含构建的源代码和 wheel 归档文件,而不是在不包含资源的情况下创建。

增强功能:

  • 通过在发布版本已存在时上传并替换构件,使发布资源的发布具备幂等性。

CI:

  • 更新发布工作流,在创建或重新运行发布任务时附加分发构件。
Original summary in English

Summary by Sourcery

Attach built distribution archives to GitHub Releases and reliably restore assets on workflow reruns.

Bug Fixes:

  • Ensure GitHub Releases include the built source and wheel archives instead of being created without assets.

Enhancements:

  • Make release asset publication idempotent by uploading and replacing artifacts when a release already exists.

CI:

  • Update the release workflow to attach distribution artifacts when creating or rerunning a release.

gh release create 不带文件 → Release 条目无二进制归档(v0.1.7 实测空资产,
已手动补挂)。创建即挂 dist/*;已存在(workflow 重跑)走 upload --clobber
幂等补传,不重复建条目。
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 17f101d7-9366-4c65-9d5a-98836fe07349


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai

sourcery-ai Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor
审查者指南(小型 PR 中折叠显示)

审查者指南

更新发布工作流,使 GitHub Release 创建时直接挂载 dist/* 构建资产;对于已存在的 Release,则通过幂等的 upload --clobber 补传或覆盖资产,修复 Release 条目资产为空的问题。

幂等发布 GitHub Release 资产的流程图

flowchart TD
    A[PyPI publish succeeds] --> B{gh release view TAG}
    B -->|Release exists| C[gh release upload TAG dist/* --clobber]
    B -->|Release missing| D[gh release create TAG --generate-notes dist/*]
    C --> E[Release contains dist assets]
    D --> E
Loading

文件级变更

变更 详细信息 文件
使 GitHub Release 创建和重跑流程都自动附带构建产物。
  • 新建 Release 时将 dist/*(sdist 和 wheel)作为资产传给 gh release create。
  • 检测到同名 Release 时改为 gh release upload,并使用 --clobber 支持重跑时幂等覆盖。
  • 保留仅在 PyPI 发布成功后执行的工作流顺序及自动生成发布说明。
.github/workflows/release.yml

提示与命令

与 Sourcery 交互

  • 触发新的审查: 在拉取请求中评论 @sourcery-ai review。
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub issue: 回复审查评论,请 Sourcery 根据该评论创建 issue。你也可以回复审查评论并使用 @sourcery-ai issue,从该评论创建 issue。
  • 生成拉取请求标题: 在拉取请求标题中的任意位置写入 @sourcery-ai,即可随时生成标题。你也可以在拉取请求中评论 @sourcery-ai title,随时(重新)生成标题。
  • 生成拉取请求摘要: 在拉取请求正文中的任意位置写入 @sourcery-ai summary,即可在你指定的位置随时生成 PR 摘要。你也可以在拉取请求中评论 @sourcery-ai summary,随时(重新)生成摘要。
  • 生成审查者指南: 在拉取请求中评论 @sourcery-ai guide,即可随时(重新)生成审查者指南。
  • 解决所有 Sourcery 评论: 在拉取请求中评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,这一功能会很有用。
  • 忽略所有 Sourcery 审查: 在拉取请求中评论 @sourcery-ai dismiss,即可忽略所有现有的 Sourcery 审查。如果你想从头开始新的审查,这一功能尤其有用——别忘了评论 @sourcery-ai review 以触发新的审查!

自定义你的体验

访问你的控制面板以:

  • 启用或停用审查功能,例如 Sourcery 生成的拉取请求摘要、审查者指南等。
  • 更改审查语言。
  • 添加、删除或编辑自定义审查说明。
  • 调整其他审查设置。

获取帮助

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

更新发布工作流,使 GitHub Release 创建时直接挂载 dist/* 构建资产;对于已存在的 Release,则通过幂等的 upload --clobber 补传或覆盖资产,修复 Release 条目资产为空的问题。

Flow diagram for idempotent GitHub Release asset publishing

flowchart TD
    A[PyPI publish succeeds] --> B{gh release view TAG}
    B -->|Release exists| C[gh release upload TAG dist/* --clobber]
    B -->|Release missing| D[gh release create TAG --generate-notes dist/*]
    C --> E[Release contains dist assets]
    D --> E
Loading

File-Level Changes

Change Details Files
使 GitHub Release 创建和重跑流程都自动附带构建产物。
  • 新建 Release 时将 dist/*(sdist 和 wheel)作为资产传给 gh release create。
  • 检测到同名 Release 时改为 gh release upload,并使用 --clobber 支持重跑时幂等覆盖。
  • 保留仅在 PyPI 发布成功后执行的工作流顺序及自动生成发布说明。
.github/workflows/release.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嘿——我已经审阅了你的更改,看起来很棒!

Sourcery 评估

需要人工审阅。 如果工作流存在错误,可能会将不正确或不完整的 sdist/wheel 文件附加到 GitHub Release 中,导致这些构建产物在 PyPI 发布已成功的情况下对外可见。回滚可以阻止后续运行,并且可以移除或替换受影响的发布资产,因此损害范围有限且可以修复。


Sourcery 对开源项目免费——如果你喜欢我们的审阅,请考虑分享它们 ✨
请帮助我变得更有用!请在每条评论上点击 👍 或 👎,我会利用这些反馈来改进审阅结果。
Original comment in English

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. If the workflow is wrong, it could attach incorrect or incomplete sdist/wheel files to a GitHub Release, making those artifacts externally visible even though the PyPI publication already succeeded. Reverting stops future runs, and the affected release assets can be removed or replaced, so the damage is bounded and repairable.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@im47cn
im47cn merged commit fb8a4c4 into main Aug 31, 2026
21 checks passed
@im47cn
im47cn deleted the ci/release-assets branch August 31, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants