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

Avoid git during build #298

Closed
wants to merge 1 commit into from
Closed

Avoid git during build #298

wants to merge 1 commit into from

Conversation

pantierra
Copy link
Contributor

Currently during build time git is being used to detect the version of tilemaker. However, when using a release package, it is not a git repository anymore and this command fails. It would be good to find an alternative. Here proposing just to set manually the version in the Makefile, but there might be better solutions to this.

@kleunen
Copy link
Contributor

kleunen commented Aug 27, 2021

Maybe this can be done using:
https://github.com/brettdorrans/write-version-to-file

@pantierra
Copy link
Contributor Author

pantierra commented Aug 27, 2021

I gave it a try, @kleunen. The limitation I see is that it "only updates the VERSION file within the CI container, so build tooling can then access this information elsewhere". However in my scenario, I really want to use the packaged files attached to the releases; to build tilemaker somewhere else.

Probably a simple, manual .VERSION file would be best. Or what would you suggest?

@pantierra pantierra marked this pull request as draft August 27, 2021 21:17
@kleunen
Copy link
Contributor

kleunen commented Aug 28, 2021

ah, yes. Then somehow with an action when a new tag is created, this version file needs to be updated and committed.
There is this, but it writes a json file:

https://github.com/dolittle/write-version-to-file-action#example-workflow

Or maybe it should be part of the release build process, that the version file is generated inside the tar.gz

@pantierra
Copy link
Contributor Author

Another option is using a git post-commit hook to create a (release) tag, when changing the version in a file:
https://coderwall.com/p/mk18zq/automatic-git-version-tagging-for-npm-modules

Which is the preference of the maintainer/s?

@systemed
Copy link
Owner

I'm not too fussed - the thing I like about the current solution is that it's effectively automatic, but good spot on the fail when using a release package. Post-commit hook sounds good if you understand it better than I do!

We'll need to include it in the cmake build (CMakeLists.txt) as well as the plain Makefile.

This also works, falling back to a date if it can't find a version, but might be a bit hackish...:

(git describe --tags --abbrev=0) 2> /dev/null || date +'%d/%m/%Y'

@kleunen
Copy link
Contributor

kleunen commented Aug 28, 2021

Another possibility might be to create a small script for making a release. Which creates the tag and writes it to a file and commits the version file

@pantierra
Copy link
Contributor Author

Yes, this is definitively not a big issue. I "fixed" it on my side with some other automatic foo that works in this place. A VERSION file, however it gets created and kept up-to-date would be a nice-to-have.

Closing here, as the code proposed is just not useful 😄

@pantierra pantierra closed this Aug 28, 2021
@pantierra pantierra deleted the feature/avoid-git-in-build branch August 28, 2021 12:12
@pantierra pantierra mentioned this pull request Sep 7, 2021
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

Successfully merging this pull request may close these issues.

3 participants