github 获取repo 发布的版本号

获取最新版本

https://api.github.com/repos/nickchou/paopao/releases/latest

获取版本列表

https://api.github.com/repos/nickchou/paopao/releases

nickhou:github账号,根据需要换成需要的
paopao:github托管的repo项目名,更换为自己想要的
http抓取数据反序列化后解析即可

案例:github获取最新版本(/releases/latest)返回的json
{
  "url": "https://api.github.com/repos/nickchou/paopao/releases/12361298",
  "assets_url": "https://api.github.com/repos/nickchou/paopao/releases/12361298/assets",
  "upload_url": "https://uploads.github.com/repos/nickchou/paopao/releases/12361298/assets{?name,label}",
  "html_url": "https://github.com/nickchou/paopao/releases/tag/v1.2",
  "id": 12361298,
  "node_id": "MDc6UmVsZWFzZTEyMzYxMjk4",
  "tag_name": "v1.2",
  "target_commitish": "master",
  "name": "paopao.v1.2",
  "draft": false,
  "author": {
    "login": "nickchou",
    "id": 5896766,
    "node_id": "MDQ6VXNlcjU4OTY3NjY=",
    "avatar_url": "https://avatars2.githubusercontent.com/u/5896766?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/nickchou",
    "html_url": "https://github.com/nickchou",
    "followers_url": "https://api.github.com/users/nickchou/followers",
    "following_url": "https://api.github.com/users/nickchou/following{/other_user}",
    "gists_url": "https://api.github.com/users/nickchou/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/nickchou/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/nickchou/subscriptions",
    "organizations_url": "https://api.github.com/users/nickchou/orgs",
    "repos_url": "https://api.github.com/users/nickchou/repos",
    "events_url": "https://api.github.com/users/nickchou/events{/privacy}",
    "received_events_url": "https://api.github.com/users/nickchou/received_events",
    "type": "User",
    "site_admin": false
  },
  "prerelease": false,
  "created_at": "2018-08-11T14:16:10Z",
  "published_at": "2018-08-11T14:19:58Z",
  "assets": [
    {
      "url": "https://api.github.com/repos/nickchou/paopao/releases/assets/8212410",
      "id": 8212410,
      "node_id": "MDEyOlJlbGVhc2VBc3NldDgyMTI0MTA=",
      "name": "paopao.v1.2.rar",
      "label": null,
      "uploader": {
        "login": "nickchou",
        "id": 5896766,
        "node_id": "MDQ6VXNlcjU4OTY3NjY=",
        "avatar_url": "https://avatars2.githubusercontent.com/u/5896766?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/nickchou",
        "html_url": "https://github.com/nickchou",
        "followers_url": "https://api.github.com/users/nickchou/followers",
        "following_url": "https://api.github.com/users/nickchou/following{/other_user}",
        "gists_url": "https://api.github.com/users/nickchou/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/nickchou/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/nickchou/subscriptions",
        "organizations_url": "https://api.github.com/users/nickchou/orgs",
        "repos_url": "https://api.github.com/users/nickchou/repos",
        "events_url": "https://api.github.com/users/nickchou/events{/privacy}",
        "received_events_url": "https://api.github.com/users/nickchou/received_events",
        "type": "User",
        "site_admin": false
      },
      "content_type": "application/octet-stream",
      "state": "uploaded",
      "size": 120482,
      "download_count": 3,
      "created_at": "2018-08-11T14:19:42Z",
      "updated_at": "2018-08-11T14:19:46Z",
      "browser_download_url": "https://github.com/nickchou/paopao/releases/download/v1.2/paopao.v1.2.rar"
    }
  ],
  "tarball_url": "https://api.github.com/repos/nickchou/paopao/tarball/v1.2",
  "zipball_url": "https://api.github.com/repos/nickchou/paopao/zipball/v1.2",
  "body": "* 新增多线程支持\r\n* 新增线程可暂停、终止功能\r\n* 继续优化log4net日志格式\r\n* 窗体resize控件自使用,虽然还是有点丑,讲究用吧\r\n* 执行结果日期格式精简\r\n* 文本日志去空格换行等"
}

转载于:https://www.cnblogs.com/nickchou/p/9533209.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值