zmk icon indicating copy to clipboard operation
zmk copied to clipboard

Add short SHA to firmware artifact/file names

Open sethforprivacy opened this issue 1 year ago • 6 comments

This commit adds a short SHA tag to the end of artifact and firmware file names so that they are unique per commit/build.

This will output a zip titled like firmware-015a40d.zip and sath65-nice_nano_v2-zmk-015a40d.uf2, where 015a40d is the 7-character short SHA ID of the head commit that kicked off the build.

Edit: The Action used to generate the SHA ID is https://github.com/marketplace/actions/short-sha, as using an action instead of a native echo command makes it portable across build OSs.

sethforprivacy avatar Jul 06 '22 13:07 sethforprivacy

@sethforprivacy I like this on principle, but the GH Action you used I don't really love. Are there really any advantages to using it over using git rev-parse --short HEAD?

petejohanson avatar Jul 26 '22 03:07 petejohanson

@sethforprivacy I like this on principle, but the GH Action you used I don't really love. Are there really any advantages to using it over using git rev-parse --short HEAD?

I went back and forth on using a simple echo or this Action, but settled on the action to ensure it works no matter the build base OS you choose in case a user changes it or it gets changed upstream in the future for some reason.

I'm happy with either approach, just preferred to make it as "fool-proof" as possible by using this dedicated Action. If you prefer the other approach I'll push a commit to do it that way instead 😀

sethforprivacy avatar Jul 26 '22 23:07 sethforprivacy

Let's stick with the call to the git executable.

petejohanson avatar Jul 26 '22 23:07 petejohanson

Let's stick with the call to the git executable.

Working on the best solution for that approach now, will ping when done and ready for review.

sethforprivacy avatar Jul 27 '22 01:07 sethforprivacy

@petejohanson pushed a squashed commit that works well for me, but it did require a simple re-ordering of the first steps of the workflow to make it work properly.

Tested and validated against my own private zmk-config repo without issues on this commit.

sethforprivacy avatar Jul 27 '22 02:07 sethforprivacy

Anything else needed from me here, @petejohanson? Should be all ready to merge!

sethforprivacy avatar Aug 17 '22 20:08 sethforprivacy