gysmo38 / mitsubishi2MQTT

Mitsubishi to MQTT with ESP8266 module
GNU Lesser General Public License v2.1
371 stars 132 forks source link

use version from git #264

Open ggrandou opened 2 months ago

ggrandou commented 2 months ago

This patch automates the version string in the firmware by using the most recent available git tag.

python script is automatically called by platformio upon build which appends a GIT_VERSION define to build flags.

version string is built from the output of git describe --tags --always --dirty command

Some version examples:

GIT_VERSION is gracefully ignored when the build is not run inside a git repository or if git fails for whatever reason.

For safety I have kept the original code if GIT_VERSION is not defined, but it could make sense to have a generic "unknown" version string or similar.

It has been tested on a linux platform. It should work on windows as well, but it's untested.