warp-more-hardware / esp32-firmware

TinkerForge WARP software for more hardware
14 stars 1 forks source link

Change build tagging from timestamp to git hash #24

Closed bs-github closed 1 year ago

bs-github commented 1 year ago

The build is suffixed with the timestamp in hex format, but the git commit hash may be more helpful.

Using the build timestamp as defining fact to identify a build is probably less desirable than something that can point to the used code.

Solution I'd like

Additional context

We have to make sure this does not interfere with the build timestamp that is used in the code to make sure the RTC clock is fine.

bs-github commented 1 year ago

maybe this can help: https://github.com/sblantipodi/platformio_version_increment

okurz commented 1 year ago

Maybe the output of git describe can help which includes the latest git tag plus commit number after that and shortened git hash so that the version is always increasing

bs-github commented 1 year ago

With the hint from @okurz, a bit of playing around led to this:

➜  software git:(logging-improvements) ✗ git status
On branch logging-improvements
Your branch is up to date with 'origin/logging-improvements'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   src/modules/ac011k/ac011k.cpp
    modified:   src/modules/ac011k/ac011k.h

➜  software git:(logging-improvements) ✗ git describe --dirty="-$(git branch --show-current)-$(date "+%Y-%m-%d-%H:%M:%S")"
warpAC011K-2.0.8-176-g7d3594a1-logging-improvements-2023-02-03-10:07:15
bs-github commented 1 year ago

Adding the build flags in build.cpp could be another improvement, but has the potential of leaking sensitive information.