shields icon indicating copy to clipboard operation
shields copied to clipboard

Question: Github release and tags

Open antograssiot opened this issue 11 years ago • 2 comments

First I apologize if this is the wrong place to ask but I'm experiencing issue with the github release and tag for cakephp/cakephp. As you can see on github and on packagist, the project is now in 3.0.0-RC1 but the badge still show 3.0.0-dev3 from almost 6 month ago.

I'm using either https://img.shields.io/github/tag/cakephp/cakephp.svg or https://img.shields.io/github/release/cakephp/cakephp.svg but still get the same result.

It might not be an issue with your badge but I though you might have an idea of what might be the reason.

Thank's by advance

antograssiot avatar Jan 24 '15 08:01 antograssiot

Hi!

This is absolutely the right place to ask.

It is a bit of a tricky situation. We rely on npm's semver library (the one actually used in npm) to guess the latest version. It doesn't try to guess the meaning of prerelease labels. It yields the following:

semver.maxSatisfying(['v3.0.0-dev3', 'v3.0.0-RC1'], '')
'v3.0.0-dev3'

I assume the reason for this is that:

'v3.0.0-dev3' > 'v3.0.0-RC1'
true

The data I receive from GitHub includes a published_at: '2015-01-02T19:09:28Z' field, but then v2.6.1 would be returned instead. There are even more critical cases in the wild, where old branches such as v1.0.0 which is superseded by v2.0.0, but a maintenance release v1.0.1 is published after v2.0.0. GitHub's release system is unfortunately fairly dumb, and since I don't rely on it much, I didn't anticipate the surprises it has brung.

What this needs is either a latest flag from GitHub, or a smarter algorithm, but I don't have it. In case you would like to try to find a solution, here's a snippet of the data we receive.

https://api.github.com/repos/cakephp/cakephp/releases

{ url: 'https://api.github.com/repos/cakephp/cakephp/releases/856971',
    assets_url: 'https://api.github.com/repos/cakephp/cakephp/releases/856971/assets',
    upload_url: 'https://uploads.github.com/repos/cakephp/cakephp/releases/856971/assets{?name}',
    html_url: 'https://github.com/cakephp/cakephp/releases/tag/2.6.1',
    id: 856971,
    tag_name: '2.6.1',
    target_commitish: 'master',
    name: 'CakePHP 2.6.1 Released',
    draft: false,
    author: 
     { login: 'markstory',
       id: 24086,
       avatar_url: 'https://avatars.githubusercontent.com/u/24086?v=3',
       gravatar_id: '',
       url: 'https://api.github.com/users/markstory',
       html_url: 'https://github.com/markstory',
       followers_url: 'https://api.github.com/users/markstory/followers',
       following_url: 'https://api.github.com/users/markstory/following{/other_user}',
       gists_url: 'https://api.github.com/users/markstory/gists{/gist_id}',
       starred_url: 'https://api.github.com/users/markstory/starred{/owner}{/repo}',
       subscriptions_url: 'https://api.github.com/users/markstory/subscriptions',
       organizations_url: 'https://api.github.com/users/markstory/orgs',
       repos_url: 'https://api.github.com/users/markstory/repos',
       events_url: 'https://api.github.com/users/markstory/events{/privacy}',
       received_events_url: 'https://api.github.com/users/markstory/received_events',
       type: 'User',
       site_admin: false },
    prerelease: false,
    created_at: '2015-01-16T02:36:35Z',
    published_at: '2015-01-16T02:41:14Z',
    assets: [],
    tarball_url: 'https://api.github.com/repos/cakephp/cakephp/tarball/2.6.1',
    zipball_url: 'https://api.github.com/repos/cakephp/cakephp/zipball/2.6.1'
}

espadrine avatar Jan 24 '15 13:01 espadrine

@espadrine OK I got it, thank's for the explanation, we might give it an other try when we hit stable but the maintenance release case you mentioned is quite likely to happen also...

antograssiot avatar Jan 25 '15 08:01 antograssiot