3 ms·
Why have the version in the source code at all? A build/packaging process should query git at build/packaging time to get the version (using git describe) and p
by globular-toast 4y ago
Why have the version in the source code at all? A build/packaging process should query git at build/packaging time to get the version (using git describe) and produce versioned artifacts (which can be source code or binaries).
- grumbel 4y agoSometimes people don't use git to get the source. The "Download ZIP" function on Github for example includes no version number at all as far as I can tell, only the branch name in the filename. For GitLab there there exist a workaround by using .gitattributes to create a VERSION file with "$Format:%(describe:tags)$" which will get expanded to the git describe string on archive creation, so the version number even survives in a .zip. GitHub however ignores .gitattributes and so far I haven't seen another way to get a version number into the .zip other than just including it in the source.
- DANK_YACHT 4y agoNot related to your broader point, but you can download source from a release via https://github.com/<org>/<repo>/archive/refs/tags/<tag>.zip https://github.com/<org>/<repo>/archive/refs/tags/<tag>.zip
- grumbel 4y agoThis works too: https://github.com/<org>/<repo>/archive/HEAD.zip https://github.com/<org>/<repo>/archive/HEAD.zip Gives a HEAD.zip that contains a "<repo>-<sha1>/" folder and the latest source.
- glacials 4y agoI'm fine with this sacrifice -- if someone downloads HEAD, they are not running a "version", so it would be misleading to have the source think it's at 1.0 or 1.1 if really it's at a commit between those two versions. I have my build scripts call the version "develop" or similar if this is the case.