Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make https://github.com/spring-cloud/spring-cloud-cli/releases/latest redirect to latest Tag #163

Open
gasrios opened this issue Sep 27, 2020 · 6 comments

Comments

@gasrios
Copy link

gasrios commented Sep 27, 2020

Enhancement

This is not code related. Several GitHub projects, including https://github.com/spring-projects/spring-boot , implement behavior that redirects "latest" URLs to their latest release, e.g.

https://github.com/spring-projects/spring-boot/releases/latest

as of now redirects to

https://github.com/spring-projects/spring-boot/releases/tag/v2.3.4.RELEASE

This does not happen for https://github.com/spring-cloud/spring-cloud-cli/releases/latest , which currently redirects to

https://github.com/spring-cloud/spring-cloud-cli/releases

This redirect feature is extremely useful when implementing automated installation scripts, and it would be great to have it working for Spring Cloud CLI, too.

@spencergibb
Copy link
Member

Is this a feature of GitHub?

@gasrios
Copy link
Author

gasrios commented Sep 27, 2020

I think so, but it is triggered by actions taken by maintainers when a new release is created. See https://stackoverflow.com/questions/24827437/github-latest-release-button-capability

"If you define releases without ever attaching a binary to any of them, then 'latest' redirects you to the releases page of your project indeed."

@gasrios
Copy link
Author

gasrios commented Sep 27, 2020

@spencergibb This might help: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/linking-to-releases

And also: https://gist.github.com/steinwaywhw/a4cd19cda655b8249d908261a62687f8#gistcomment-2602381

I did some testing and looks like GitHub can create releases from tags you create (git tag -m "${MESSAGE}" -a "${TAG}" && git push origin "${TAG}"), but, unless you create releases directly on GitHub (which in turn will create the tag for you), the redirect behavior will not work.

I also tried retrieving the same information using the API, and got an error:

$ curl -s https://api.github.com/repos/spring-cloud/spring-cloud-cli/releases/latest
{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest/reference/repos#get-the-latest-release"
}

All this suggests your current process creates and pushes tags to GitHub. Would it be possible to support creating releases instead, for example using GitHub CLI (https://cli.github.com/manual/gh_release_create)?

@spencergibb
Copy link
Member

"If you define releases without ever attaching a binary to any of them, then 'latest' redirects you to the releases page of your project indeed".

We don't do binary releases to GitHub at all. I'm not sure we want to change our release process right now, but I'll mark it to discuss.

@gasrios
Copy link
Author

gasrios commented Sep 27, 2020

"If you define releases without ever attaching a binary to any of them, then 'latest' redirects you to the releases page of your project indeed".

We don't do binary releases to GitHub at all. I'm not sure we want to change our release process right now, but I'll mark it to discuss.

It's likely this feedback was incorrect (sorry about that, I was still in the middle of my research), please see my other comment, just after that one.

My own tests have shown that the issue probably is your current release process creates tags, then pushes them to GitHub. GitHub will create a release associated to the new tag, but not a redirect from "latest" to it.

The fix would be to change that process, so you create releases, and delegate creating the associated tag to GitHub, which happens automatically.

@spencergibb
Copy link
Member

Either way it's a change in release process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants