-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add to install make target to ensure that when a change is made to the main branch, that the commit hash is referenced as the version. #82
Comments
What are you thiking when you say non-releases? Could you give more info? |
I am saying that for any changes on main that the version is reported as a commit hash.
Agreed, it seems like a difficult task to do.
I am unsure as of now, but as I understand it, the commit hash is based on the file changes. It would depend on how the logic is implemented but if it was done as a recursive check, then that is correct. After thinking about your questions, it might be best to close this comment and re-evaluate the issue at hand, and re-open if needed. Thanks for questioning the realisation of the issue. :) |
@R-Lawton it seems like interest is ramping up for making this happen. It might be a good idea to research it further to see if it is possible. Therefore, I am going to re-open. :) |
@R-Lawton I believe it is possible to do, but not as a GitHub Action. We could use |
For example, we could implement this code in func getCommitHash() (string, error) {
cmd := exec.Command("git", "rev-parse", "HEAD")
output, err := cmd.Output()
if err != nil {
return "v0.0.0", err
}
commitHash := strings.TrimSpace(string(output))
return commitHash, nil
}
version, err := getCommitHash()
if err != nil {
// implement code logic here to print v0.0.0 for systems without git installed
}
// implement code logic here to print commit hash for systems with git installed |
WIP #85 |
Closing as resolved in #85 . |
What:
For non-releases, on
main
branch, when there is a new change made, a GitHub action should pick this up and change the version inversion/version.go
to something along the lines ofdev - "commit hash"
so that when the user builds the binary and runs./kuadrantctl version
it reports:The text was updated successfully, but these errors were encountered: