cli / gh-extension-precompile

Action for publishing binary GitHub CLI extensions
MIT License
91 stars 39 forks source link

Setting a version number with ldflags #14

Open chelnak opened 2 years ago

chelnak commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

@josebalius

mislav commented 2 years ago

@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 commented 2 years ago

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 commented 1 year ago

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 No i don't want to b apart of this I'm here cuz my psycho ex has stolen my identity and started all this stuff on github and I'm trying to remove everything cuz wat ever she did follows me from phone to phone and she's messing with my 7yr old daughter and steals from my family and i so please don't include me in that I'm trying to figure out how to get rid of all these tags and extensions