Mar*_*cze 5 deployment continuous-integration github
在 GitHub 上,我可以通过类似 的链接访问特定版本的发行版https://github.com/markvincze/golang-build-test/releases/tag/hello-v6。
我可以从该版本下载其工件https://github.com/markvincze/golang-build-test/releases/download/hello-v6/filename。
我还可以通过以下方式访问最新版本https://github.com/markvincze/golang-build-test/releases/latest
问题:有没有办法直接下载最新版本的工件?
我尝试过https://github.com/markvincze/golang-build-test/releases/download/latest/filename,但它不起作用,而且我在文档中找不到任何内容。
您可以使用例如HTTPHEAD请求方法来确定最新标签:
HEAD https://github.com/markvincze/golang-build-test/releases/latest
Run Code Online (Sandbox Code Playgroud)
在撰写本文时,这将返回一个包含以下两个标头的响应:
Status: 302 Found
Location: https://github.com/markvincze/golang-build-test/releases/tag/hello-v6
Run Code Online (Sandbox Code Playgroud)
使用此功能,您现在应该能够使用适当的标签提交第二个请求。
有关详细信息,请参阅Wikipedia 的 HTTP 302 文章。
另一种选择是使用GitHub API 提供的获取最新版本端点,然后类似地发出第二个请求。在这种情况下,tag_name响应中的关键将会有所帮助。