我正在尝试找出在GitHub上生成构建的单命令过程。
我期望做的是运行某种命令的发布版本,例如,发布版本脚本会构建发布 Artifact ,然后以某种方式将其上传到GitHub。
但是,我对如何在GitHub上实际获得发布 Artifact 感到困惑。源代码很棒,但并非每个人都希望自己构建。 :-)
最佳答案
Update September 2013,您可以自动化发布(API in preview mode)
Update January 2014,这是一个非官方的命令行应用程序,由github-release称为 Nicolas Hillegeer ( aktau
) ,用于创建发行版和上传(二进制) Artifact 。
它使用上面提到的新的github版本API。查看项目的Makefile,以了解如何进一步使其自动化。
例:
# 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
$ 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,
...
}
$ 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
$ 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"
Update 2d July 2013,您现在可以定义发行版。
这是替换old binary upload service的removed in December 2012的内容!
这意味着将其添加到常规的本地存储库中(“it”是由一个或几个文件组成,通常包括二进制文件),然后将该存储库推送到与其匹配的GitHub存储库中。
话虽如此,之所以没有在任何“发布”任务中提及GitHub,是因为Git是一种源代码管理管理系统,不适用于二进制文件。
它当然可以具有这些文件(二进制文件),但是不能使它们有规律地存储,因为一段时间后回购的大小过大:每次克隆都将花费越来越长的时间。
另请参见What are the Git limits和“git - should source files and repository be on the same machine ?”。
关于github - 如何使用脚本在GitHub上发布构建工件 Assets ?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5207269/