使用发布分支发布集合
集合必须遵循 语义版本控制 规则。有关高级详细信息,请参见 发布集合。
发布计划和公告
- 在集合的相应置顶发布问题/社区公告板和 - #ansible-communityMatrix/IRC 频道 中宣布您发布集合的意图。如果存在其他专用频道,请在其中重复公告。
- 确保所有其他存储库维护者都了解以下发布的时间。 
发布主要集合版本
假定新版本为 X.0.0。
- 确保 - galaxy.yml包含正确的版本号- X.0.0。如果不是这种情况,请创建一个 PR 来更新它。这将导致健全性测试失败,因为必须在- X.0.0中删除所有弃用,因此这可能需要大量工作,并且应该在主要版本发布前几周完成。
- 检查集合中是否存在主要版本中计划删除但健全性测试未报告的弃用。使用过去的变更日志或在存储库中运行 - grep -r `X.0.0` plugins/。
- 如果要发布 - community.general和- community.network集合,请在相应的存储库中创建一个新的- backport-X标签。从相应的现有标签复制样式和描述。
- 确保您位于本地分支中的默认分支中。这些示例使用 - main。
git status git checkout main # if needed
- 更新您的本地分支 
git pull --rebase upstream main
创建发布分支
- 创建一个分支 - stable-X。将- X替换为正确的数字,并将其推送到 上游 存储库,而不是推送到- origin。
git branch stable-X main git push upstream stable-X
- 从 - main分支创建并检出到另一个分支
git checkout -b update_repo
- 将分支中 - galaxy.yml中的版本更新为下一个 预期 版本,例如,- X.1.0。
创建变更日志
- 将 - changelogs/changelog.yml替换为
ancestor: X.0.0 releases: {}
- 从 - changelogs/fragments/中删除所有变更日志片段。删除变更日志片段可确保每个主要版本都有一个变更日志,描述自上次主要版本以来的更改。
- 添加并提交所有更改。将分支推送到 - origin存储库。
- 在集合存储库中创建一个拉取请求。如果 CI 测试通过,则合并拉取请求,因为 - main分支正在等待下一个次要/主要版本的更改
- 切换到 - stable-X分支。
- 在 - stable-X分支中,验证- galaxy.yml是否包含正确的版本号- X.0.0。
- 在 - stable-X分支中,确保- changelogs/changelog.yml包含正确的祖先版本
ancestor: X-1.0.0 releases: {}
- 在 - stable-X分支中,添加一个变更日志片段- changelogs/fragments/X.0.0.yml,其内容为
release_summary: |- Write some text here that should appear as the release summary for this version. The format is reStructuredText, but not a list as for regular changelog fragments. This text will be inserted into the changelog.例如
release_summary: This is release 2.0.0 of ``community.foo``, released on YYYY-MM-DD.
- 在 - stable-X分支中,生成变更日志
antsibull-changelog release --cummulative-release
- 在 - stable-X分支中,验证- CHANGELOG.rst的外观是否符合预期。
- 在 - stable-X分支中,更新- README.md,以便变更日志链接指向- /tree/stable-X/,而不再指向- /tree/main/,并分别更改徽章,例如,在 AZP 的情况下,将- ?branchName=stable-X添加到 AZP CI 徽章(https://dev.azure.com/ansible/community.xxx/_apis/build/status/CI?branchName=stable-X)。
- 在 - stable-X分支中,添加、提交并将更改推送到 上游 存储库(而不是- origin),包括- README.md、- CHANGELOG.rst和- changelogs/changelog.yaml,以及可能删除/存档的片段。
发布集合
- 在 - stable-X分支中,使用集合版本- X.0.0将带注释的标签添加到最后一次提交。将此标签推送到- upstream存储库将使 Zuul 在 Ansible Galaxy 上发布该集合。
git tag -n # see current tags and their comments git tag -a NEW_VERSION -m "comment here" # the comment can be, for example, "community.foo: 2.0.0" git push upstream NEW_VERSION
- 如果集合使用 Zuul 来发布其版本,请等待新版本发布到集合的 Ansible Galaxy 页面。它将显示在可供下载的 tarball 列表中。 
- 如果发布 tarball 在推送标签后几个小时内没有出现,请尝试重新标记发布提交并再次推送该标签。在位于发布提交的 - stable-X分支中
git tag --delete NEW_VERSION git push upstream :NEW_VERSION git tag -a NEW_VERSION -m "comment here" # the comment can be, for example, "community.foo: 2.0.0" git push upstream NEW_VERSION
- 为新标签添加一个 GitHub 发布。标题应为版本和内容,例如 - - 有关所有更改,请参见 https://github.com/ansible-collections/community.xxx/blob/stable-X/CHANGELOG.rst。
- 通过 Bullhorn 新闻稿 发布此版本。 
- 在集合的置顶发布问题/社区公告板中和 - #ansible-communityMatrix/Libera.Chat IRC 频道 中宣布此版本。
- 在 - stable-X分支中,将- galaxy.yml中的版本更新为下一个 预期 版本,例如,- X.1.0。添加、提交并推送到 上游 存储库。
发布次要集合版本
假定新版本为 X.Y.0。预计所有应该进入其中的更改都已从默认分支向后移植到 stable-X 分支。
创建变更日志
- 在 - stable-X分支中,请确保- galaxy.yml文件包含正确的版本号- X.Y.0。如果不是,请更新它。
- 在 - stable-X分支中,添加一个 changelog 片段- changelogs/fragments/X.Y.0.yml,内容如下:
release_summary: |- Write some text here that should appear as the release summary for this version. The format is reStructuredText, but not a list as for regular changelog fragments. This text will be inserted into the changelog.
- 在 - stable-X分支中,运行以下命令:
antsibull-changelog release
- 在 - stable-X分支中,验证- CHANGELOG.rst文件是否符合预期。
- 在 - stable-X分支中,将- CHANGELOG.rst和- changelogs/changelog.yaml的更改添加、提交并推送到 **上游(upstream)** 仓库,而不是 origin 仓库。同时,可能需要删除/归档片段。
发布集合
- 在 - stable-X分支中,使用集合版本- X.Y.0对最后一次提交添加一个带注释的标签。将此标签推送到- upstream仓库将使 Zuul 在 Ansible Galaxy 上发布该集合。
git tag -n # see current tags and their comments git tag -a NEW_VERSION -m "comment here" # the comment can be, for example, "community.foo: 2.1.0" git push upstream NEW_VERSION
- 等待新版本发布到集合的 Ansible Galaxy 页面。发布的版本将出现在可供下载的 tar 包列表中。 
- 为新标签添加一个 GitHub 发布。标题应为版本和内容,例如 - - 有关所有更改,请参见 https://github.com/ansible-collections/community.xxx/blob/stable-X/CHANGELOG.rst。
- 通过 Bullhorn 新闻稿 发布此版本。 
- 在集合的置顶发布 issue/社区公告栏以及 - #ansible-communityMatrix/IRC 频道中宣布此版本发布。此外,您可以使用 GitHub 的 Releases 系统宣布此版本。
- 在 - stable-X分支中,将- galaxy.yml中的版本更新为下一个**预期**版本。例如,如果您已发布- X.1.0,则下一个预期版本可能是- X.2.0。添加、提交并推送到 **上游(upstream)** 仓库。
- 切换到 - main分支。
- 在 - main分支中
如果在下一个主版本发布之前发布了更多次要版本,也请将
galaxy.yml中的版本更新为X.(Y+1).0。创建一个专门的拉取请求并合并。
如果下一个版本将是一个新的主版本,创建一个拉取请求,在其中将
galaxy.yml中的版本更新为(X+1).0.0。请注意,由于计划在(X+1).0.0中删除的弃用项,健全性测试很可能会失败,这些弃用项会被测试标记出来。对于每个此类弃用项,请决定:
是否立即删除它们。例如,您可以删除整个
modules/plugins或删除重定向。
是否将忽略条目添加到相应的
tests/sanity/ignore-*.txt文件并创建 issue,例如针对modules/plugins中删除的功能。一旦 CI 测试通过,请合并拉取请求。请确保此拉取请求在发布后不久合并,以避免
version_added健全性测试对新功能拉取请求期望错误的版本。
注意
在发布前的几天进行一些删除是有意义的。这些删除必须在 main 分支中进行,并且不能向后移植。
发布补丁版本
假设新版本为 X.Y.Z,之前的补丁版本为 X.Y.z,其中 z < Z。z 通常为 0,因为补丁版本不常见。
在预期更多次要版本时发布
- 检出 - X.Y.z标签。
- 更新 - galaxy.yml,使版本为- X.Y.Z。添加并提交。
- 从 - stable-X中拣选(cherry-pick)- X.Y.z之后添加的所有更改,这些更改应该进入- X.Y.Z。
- 添加一个 changelog 片段 - changelogs/fragments/X.Y.Z.yml,内容如下:
release_summary: |- Write some text here that should appear as the release summary for this version. The format is reStructuredText but not a list as for regular changelog fragments. This text will be inserted into the changelog.添加到 Git 并提交。
- 生成 changelogs。 
antsibull-changelog release
- 验证 - CHANGELOG.rst文件是否符合预期。
- 将对 - CHANGELOG.rst和- changelogs/changelog.yaml的更改,以及可能已删除/归档的片段添加并提交。
发布集合
- 使用集合版本 - X.Y.Z对最后一次提交添加一个带注释的标签。将此标签推送到- upstream仓库将使 Zuul 在 Ansible Galaxy 上发布该集合。
git tag -n # see current tags and their comments git tag -a NEW_VERSION -m "comment here" # the comment can be, for example, "community.foo: 2.1.1" git push upstream NEW_VERSION
- 等待新版本发布到集合的 Ansible Galaxy 页面。它将出现在可供下载的 tar 包列表中。 
- 为新标签添加一个 GitHub 发布。标题应为版本和内容,例如 - - 有关所有更改,请参见 https://github.com/ansible-collections/community.xxx/blob/stable-X/CHANGELOG.rst。
注意
此版本的更改数据仅包含在标签中,而不包含在分支中,特别是
stable-X中。这是故意的,因为下一个次要版本X.(Y+1).0已经包含了X.Y.Z的更改,因为这些更改是从stable-X中拣选出来的。
- 通过 Bullhorn 新闻稿 发布此版本。 
- 在集合的置顶发布 issue/社区公告栏以及 - #ansible-communityMatrix/IRC 频道 <https://docs.ansible.org.cn/ansible/devel/community/communication.html#real-time-chat> 中宣布此版本发布。
在不预期更多次要版本时发布
- 在 - stable-X分支中,请确保- galaxy.yml文件包含正确的版本号- X.Y.Z。如果不是,请更新它!
- 在 - stable-X分支中,添加一个 changelog 片段- changelogs/fragments/X.Y.Z.yml,内容如下:
release_summary: |- Write some text here that should appear as the release summary for this version. The format is reStructuredText, but not a list as for regular changelog fragments. This text will be inserted into the changelog.
- 在 - stable-X分支中生成 changelogs。
antsibull-changelog release
- 在 - stable-X分支中,验证- CHANGELOG.rst文件是否符合预期。
- 在 - stable-X分支中,将- CHANGELOG.rst和- changelogs/changelog.yaml的更改添加、提交并推送到 **上游(upstream)** 仓库,而不是 origin 仓库。同时,可能需要删除/归档片段。
发布集合
- 在 - stable-X分支中,使用集合版本- X.Y.Z对最后一次提交添加一个带注释的标签。将此标签推送到- upstream仓库将使 Zuul 在 Ansible Galaxy 上发布该集合。
git tag -n # see current tags and their comments git tag -a NEW_VERSION -m "comment here" # the comment can be, for example, "community.foo: 2.1.1" git push upstream NEW_VERSION
- 等待新版本发布到集合的 Ansible Galaxy 页面。它将出现在可供下载的 tar 包列表中。 
- 为新标签添加 GitHub 发布。标题应为版本和内容,例如: - 查看 https://github.com/ansible-collections/community.xxx/blob/stable-X/CHANGELOG.rst 了解所有更改。
- 通过 Bullhorn 新闻稿 发布此版本。 
- 在集合的置顶 issue/社区公告栏以及 - #ansible-communityMatrix/IRC 频道中宣布此版本发布。
