Skip to main content

管理仓库中的发行版

您可以创建要捆绑的发行版,并将项目的迭代交付给用户。

Repository collaborators and people with write access to a repository can create, edit, and delete a release.

关于发行版管理

You can create new releases with release notes, @mentions of contributors, and links to binary files, as well as edit or delete existing releases.

您也可以在 GitHub Marketplace 中从特定的发行版发布操作。 更多信息请参阅“在 GitHub Marketplace 中发布操作”。

您可以选择是否将 Git Large File Storage (Git LFS) 对象包含在 GitHub 为每个发行版创建的 ZIP 文件和 tarball 中。 更多信息请参阅“管理仓库存档中的 Git LFS 对象”。

创建发行版

  1. 在 GitHub.com 上,导航到仓库的主页面。

  2. To the right of the list of files, click Releases. 右侧边栏中的 Releases(发行版)部分

  3. 单击 Draft a new release(草拟新发行版)

    Releases draft button

  4. Click Choose a tag, type a version number for your release, and press Enter. Alternatively, select an existing tag.

    Enter a tag

  5. If you are creating a new tag, click Create new tag.

    Confirm you want to create a new tag

  6. If you have created a new tag, use the drop-down menu to select the branch that contains the project you want to release.

    Choose a branch

  7. 键入发行版的标题和说明。 If you @mention any GitHub users in the description, the published release will include a Contributors section with an avatar list of all the mentioned users. Alternatively, you can automatically generate your release notes by clicking Auto-generate release notes.

    发行版说明

  8. (可选)要在发行版中包含二进制文件(例如已编译的程序),请在二进制文件框中拖放或手动选择文件。 通过发行版提供 DMG

  9. 要通知用户发行版本尚不可用于生产,可能不稳定,请选择 This is a pre-release(这是预发布)将版本标记为预发行版的复选框

  10. Optionally, if GitHub Discussions are enabled in the repository, select Create a discussion for this release, then select the Category drop-down menu and click a category for the release discussion. 用于创建发行版讨论和下拉菜单以选择类别的复选框

  11. 如果您准备推广您的发行版,请单击 Publish release(发布版本)。 要在以后处理该发行版,请单击 Save draft(保存草稿)发布版本和草拟发行版按钮 You can then view your published or draft releases in the releases feed for your repository. For more information, see "Viewing your repository's releases and tags."

    Published release with @mentioned contributors

要了解有关 GitHub CLI 的更多信息,请参阅“关于 GitHub CLI”。

  1. To create a release, use the gh release create subcommand. Replace tag with the desired tag for the release.

    gh release create tag
  2. Follow the interactive prompts. Alternatively, you can specify arguments to skip these prompts. For more information about possible arguments, see the GitHub CLI manual. For example, this command creates a prerelease with the specified title and notes.

    gh release create v1.3.2 --title "v1.3.2 (beta)" --notes "this is a beta release" --prerelease

If you @mention any GitHub users in the notes, the published release on GitHub.com will include a Contributors section with an avatar list of all the mentioned users.

编辑发行版

  1. 在 GitHub.com 上,导航到仓库的主页面。

  2. To the right of the list of files, click Releases. 右侧边栏中的 Releases(发行版)部分

  3. On the right side of the page, next to the release you want to edit, click . 编辑发行版

  4. Edit the details for the release in the form, then click Update release. If you add or remove any @mentions of GitHub users in the description, those users will be added or removed from the avatar list in the Contributors section of the release. 更新发行版

Releases cannot currently be edited with GitHub CLI.

删除发行版

  1. 在 GitHub.com 上,导航到仓库的主页面。

  2. To the right of the list of files, click Releases. 右侧边栏中的 Releases(发行版)部分

  3. On the right side of the page, next to the release you want to delete, click . 删除发行版

  4. 单击 Delete this release(删除此发行版)确认删除发行版

  1. To delete a release, use the gh release delete subcommand. Replace tag with the tag of the release to delete. Use the -y flag to skip confirmation.

    gh release delete tag -y