2022 年更新:官方 GitHub CLI 附带gh release upload https://cli.github.com/manual/gh_release_upload
将资产文件上传到 GitHub 版本。
您可以先使用以下命令创建版本gh release create https://cli.github.com/manual/gh_release_create
Upload all tarballs in a directory as release assets
$ gh release create v1.2.3 ./dist/*.tgz
Upload a release asset with a display label
$ gh release create v1.2.3 '/path/to/asset.zip#My display label'
2013 年 9 月更新 http://developer.github.com/changes/2013-09-25-releases-api/, 你可以自动化发布 (预览模式下的 API http://developer.github.com/v3/repos/releases/#preview-mode)
2014 年 1 月更新 https://github.com/aktau/github-release,有一个非官方的命令行应用程序,名为github-发布 https://github.com/aktau/github-release by 尼古拉斯·希勒格尔(aktau) https://github.com/aktau,用于创建版本和上传(二进制)工件。
它使用上面提到的新的 github 发布 API。看着那(这Makefile https://github.com/aktau/github-release/blob/master/Makefile了解该项目,了解如何进一步实现自动化。
Example:
# create a formal release
$ github-release release \
--user aktau \
--repo gofinance \
--tag v0.1.0 \
--name "the wolf of source street" \
--description "Not a movie, contrary to popular opinion. Still, my first release!" \
--pre-release
由于二进制资产的原因,此 API 略有不同。请求发布资产时,我们使用 Accept 标头进行内容协商。
传递标准 API 媒体类型以获取 API 表示:
$ curl -i -H "Authorization: token TOKEN" \
-H "Accept: application/vnd.github.manifold-preview" \
"https://uploads.github.com/repos/hubot/singularity/releases/assets/123"
HTTP/1.1 200 OK
{
"id": 123,
...
}
通过“application/octet-stream”来下载二进制内容。
$ curl -i -H "Authorization: token TOKEN" \
-H "Accept: application/octet-stream" \
"https://uploads.github.com/repos/hubot/singularity/releases/assets/123"
HTTP/1.1 302 Found
上传是通过对同伴的单个请求来处理的“uploads.github.com
“ 服务。
$ curl -H "Authorization: token TOKEN" \
-H "Accept: application/vnd.github.manifold-preview" \
-H "Content-Type: application/zip" \
--data-binary @build/mac/package.zip \
"https://uploads.github.com/repos/hubot/singularity/releases/123/assets?name=1.0.0-mac.zip"
更新日期 2013 年 7 月 2 日 https://github.com/blog/1547-release-your-software,你现在可以定义一个版本.
- 版本均附有发行说明以及下载软件或源代码的链接。
- 遵循许多 Git 项目的惯例,版本与 Git 标签相关联。您可以使用现有标签,或者让版本在发布时创建该标签。
-
您还可以将二进制资产(例如编译的可执行文件、缩小的脚本、文档)附加到发行版。发布后,任何可以查看存储库的人都可以使用发布详细信息和资产。
这就是取代的旧的二进制上传服务 https://stackoverflow.com/q/6978954/6309,这是2012 年 12 月删除 https://github.com/blog/1302-goodbye-uploads!
make 发布脚本构建发布工件,然后以某种方式将其上传到 github。
这意味着将其(“它”是由一个或多个文件组成的交付,通常包括二进制文件)添加到常规本地存储库,然后将该存储库推送到其匹配的 GitHub 存储库。
话虽这么说,在任何“发布”任务中都没有提及 GitHub 的原因是因为 Git 是一个source控制管理系统,并且不适合二进制文件。
当然,它可以拥有这些文件(二进制文件),但不会定期拥有它们,因为一段时间后存储库的大小会变得臃肿:每次克隆将花费越来越长的时间。
See Git 的限制是什么 https://stackoverflow.com/questions/984707/what-are-the-git-limits/984973#984973, 并且 ”git - 源文件和存储库应该在同一台机器上吗? https://stackoverflow.com/questions/5081074/git-should-source-files-and-repository-be-on-the-same-machine/5081959#5081959".