场景:
如果我们项目中需要实现某个Github
公共软件的最新版本更新
那么获取软件的最新的发布版本就是一个比较重要的工作了
对此,Github
提供对外api
不需要自己手动填写脚本了
解决方案:
替换黄色字体的项目地址,然后在cmd中执行:
curl -s https://api.github.com/repos/AsterCass/yuno-app-video-tool/releases/latest | findstr "browser_download_url"
-------------------------------------------------
补充:
#私有仓库
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/releases/latest
#公共仓库
#windows
curl -s https://api.github.com/repos/AsterCass/yuno-app-video-tool/releases/latest | findstr "browser_download_url"
#linux
curl -s https://api.github.com/repos/AsterCass/yuno-app-video-tool/releases/latest | grep "browser_download_url"
来源:
通过命令行获取github项目的最新版本
https://www.astercasc.com/article/detail?articleId=AT1671435483366051
GitHub REST API documentation - GitHub Docs
https://docs.github.com/en/rest