码迷,mamicode.com
首页 > 其他好文 > 详细

github 获取repo 发布的版本号

时间:2018-08-25 14:28:27      阅读:299      评论:0      收藏:0      [点我收藏+]

标签:browser   sts   state   false   MTA   https   log4net   set   html   

获取最新版本

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* 文本日志去空格换行等"
}

github 获取repo 发布的版本号

标签:browser   sts   state   false   MTA   https   log4net   set   html   

原文地址:https://www.cnblogs.com/nickchou/p/9533209.html

(1)
(2)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!