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

Setting a version number with ldflags #14

Open
chelnak opened this issue Jan 14, 2022 · 5 comments
Open

Setting a version number with ldflags #14

chelnak opened this issue Jan 14, 2022 · 5 comments

Comments

@chelnak
Copy link

chelnak commented Jan 14, 2022

Hey!

Would you consider using ldflags to allow developers to bake a version number in to the binaries?

https://www.digitalocean.com/community/tutorials/using-ldflags-to-set-version-information-for-go-applications

It could be an optional parameter for the action coupled with some documentation.

I'd be happy to submit a PR if it's something you think could be useful.

@chelnak
Copy link
Author

chelnak commented Jan 15, 2022

Here is a version of your bash script that I am using to achieve the above:

https://github.com/chelnak/gh-environments/blob/32d3ee6f12638a6f8ab5577ba89b838254abd0b7/build.sh

Resulting in a binary that has a version number

image

@MdAbulHossain1
Copy link

@josebalius

@mislav
Copy link
Contributor

mislav commented Jun 8, 2022

@chelnak It's a solid proposal, but I'm thinking of a better solution to having each individual extension bake their version number in: since GitHub CLI knows the version number (or git SHA) of every extension installed, how about making a change to GitHub CLI so that gh <extension-command> --version just returns the installed version without ever consulting the extension executable itself?

@chelnak
Copy link
Author

chelnak commented Jun 8, 2022

That could be really neat!

I'd actually forgotten about this PR and ended up using goreleaser for my extension.

I wonder what happens if the extension wants to check for version updates. It's handy having the current version within the context of the app for this purpose..

You could call back in to the main cli with the SDK I guess.. or even implement a helper method.

What do you think?

@ghost

This comment was marked as spam.

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

No branches or pull requests

3 participants