Fork me on GitHub
#tools-deps
<
2022-09-04
>
didibus22:09:52

How do people publish both a readme with the correct git deps which needs the sha and do the commit? Do you just make a release and push a README update separately after?

lread22:09:19

Ya it’s a bit of a catch-22. You want your docs that describe your release to be included in your release but they really can’t.

didibus22:09:29

Ya, I guess I'll leave the sha empty for the release, and then push one more commit which just adds the sha back to the doc

seancorfield22:09:18

Yup, that's what I do: update everything -- code, docs, build, etc -- and then cut the release, and then update the README (and CHANGELOG) to have the sha of that release. With major.minor.commits, at least you can figure out what the commits part is going to be in advance.

didibus22:09:09

How do you figure out commit in advance?

seancorfield22:09:27

git rev-list --count HEAD tells you what it is now: so you know it's going to be one more when you make that final commit to update the version number immediately prior to release.

seancorfield22:09:57

tools.build has a function for getting this number so you can do a bunch of stuff programmatically in build.clj as well if you want.

didibus22:09:30

Cool, ah ya I think I remember seing it: (b/git-count-revs nil) I think

1
lread23:09:35

But you are kinda outta luck for the :git/sha in your docs. I mean like: io.github.cognitect-labs/test-runner {:git/tag "v0.5.1" :git/sha "dfb30dd"} (related: gonna get around to that cljdoc/<version> git tag sometime soon @U04V70XH6!)

1
seancorfield23:09:43

Yeah, I put :git/tag "v1.2.3" :git/sha "..." in when I make a release and then update it with the short sha immediately afterward.

skylize01:09:34

While git still uses SHA1 instead of SHA256 it should be viable to build a tool that predicts the next hash. Some ideas on it here https://stackoverflow.com/questions/16951299/is-it-possible-to-precompute-a-git-commit-hash-such-that-it-can-be-placed-in-the

skylize01:09:35

... or more specifically, viable to predict the short hash, which is all we care about here.

seancorfield02:09:09

Interesting. Thank you @U90R0EPHA!