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

The binaries built by the release action include the commit hash in their version #38

Open
ejpcmac opened this issue Sep 28, 2024 · 1 comment
Labels
A:CLI Area: CLI T:Bug Type: Bug
Milestone

Comments

@ejpcmac
Copy link
Owner

ejpcmac commented Sep 28, 2024

Problem description

If I run a binary downloaded from the release page and print its short version, I get the following:

$ ./git-z-0.2.1-x86_64-unknown-linux-musl -V
git-z 0.2.1+e0e62f1

Expected behaviour

In releases, the short version should not contain the Git revision.

Analysis

In the different build jobs of the release action, the Git repository is cloned using actions/checkout@v4 without any parameter. By default, this only does a shallow clone, which does not include tags. Hence, the build.rs is not able to check whether the build is made from a tag matching the version, and the revision is then included.

Solution

Set fetch-tags: true in the parameters for actions/checkout@v4 for the build-bin, build-deb and build-msi jobs.

^ This solution makes the fetch fail. Replacing it with fetch-depth: 0 makes the build work again, but… does still include the hash.

@ejpcmac ejpcmac added this to the git-z 0.2.2 milestone Sep 28, 2024
@ejpcmac ejpcmac added A:CLI Area: CLI T:Bug Type: Bug labels Sep 28, 2024
@ejpcmac ejpcmac moved this from Backlog to Preparation in ejpcmac’s personal OSS work Dec 5, 2024
@ejpcmac ejpcmac moved this from Preparation to Ongoing in ejpcmac’s personal OSS work Dec 5, 2024
ejpcmac added a commit that referenced this issue Dec 5, 2024
The `build.rs` includes the commit hash by default in the version, but
omits it when git-z is built exactly from a release tag. However, tags
were not fetched in the release builds, making them include the commit
hash even for releases.

Refs: #38
@ejpcmac ejpcmac moved this from Ongoing to In Review in ejpcmac’s personal OSS work Dec 5, 2024
@ejpcmac ejpcmac moved this from In Review to Solved in ejpcmac’s personal OSS work Dec 7, 2024
@ejpcmac ejpcmac closed this as completed Dec 8, 2024
@ejpcmac
Copy link
Owner Author

ejpcmac commented Dec 8, 2024

Actually this is not solved 😭

$ ./git-z-0.2.2-x86_64-unknown-linux-musl -V
git-z 0.2.2+45b8aee

@ejpcmac ejpcmac reopened this Dec 8, 2024
@ejpcmac ejpcmac modified the milestones: git-z 0.2.2, git-z 0.2.3 Dec 8, 2024
@ejpcmac ejpcmac moved this from Input to Backlog in ejpcmac’s personal OSS work Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:CLI Area: CLI T:Bug Type: Bug
Projects
Status: Backlog
Development

No branches or pull requests

1 participant