cli / go-gh

A Go module for interacting with gh and the GitHub API from the command line.
https://pkg.go.dev/github.com/cli/go-gh/v2
MIT License
322 stars 45 forks source link

releasing/installing extensions #24

Closed jeffmcaffer closed 2 years ago

jeffmcaffer commented 2 years ago

First, this is awesome. I started out assuming I was going to need to hack my commands into the CLI proper and then found the extension mechanism. Perfect.

I have a question about how to release the extension so others can install it. I wrote up a quick Go-based extension, put it in a gh-* repo and installed it locally (gh extension install .). Worked like a charm. So good I want to share. I saw the template put in a release workflow so I went ahead and tagged and pushed and the workflow ran and I duly got a mess of binaries in a release. Great.

I flipped back to my client and ran gh extension install org/gh-repo and it complains that extension is uninstallable: missing executable. I'm not sure how this is supposed to work. The doc said a few things about having to have "the executable" in the root of the repo but for compiled code

Seems ideal here to use the Release mechanism and say that installing gets the executables from latest release by default and you can say something like install org/repo@v1.4 if you want a specific release.

samcoe commented 2 years ago

@jeffmcaffer Can you link to the extension that you are having trouble installing?

The release workflow in the template is here and it should properly generate binaries and attach them to a release so gh can install them. That is the paved paths for binary extensions rather than checking in the precompiled binaries to the repo as the files can be large and lead to huge repo sizes. Having said that the error message you are receiving is gh being unable to find the release and binaries so it would seem that something is up there.

Lastly, right now there is no support for installing a specific version or git ref of an extension, we have an open issue https://github.com/cli/cli/issues/5067 to discuss that feature though.

jeffmcaffer commented 2 years ago

Sigh. Seems that I had the name of the org wrong so was trying to install something that didn't exist. Human error.

Having said that, would be great if the error message pointed out that the repo requested could not be found as that was the more general problem.

Thanks and sorry for the hassle. Great feature.