feat: Add PR number to version string on PR builds (#1887)
* Add PR number to version string * Testing another way * Decide according to GitHub ref type how to parse and where to output. Prioritize EDGETX_VERSION_TAG, if set, else resort to EDGETX_VERSION_SUFFIX, if set. Adjust also firmware_version and boot_version strings and adjist bootloader title. * Consider also B/W. * B&W: omit GIT SHA if tagged, otherwise own line Omit GIT SHA from version string if a tagged version. Otherwise, show on own line since is too long for 128x64 B&W displays. Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
+12
-6
@@ -48,14 +48,20 @@ fi
|
||||
|
||||
: ${SRCDIR:=$(dirname "$(pwd)/$0")/..}
|
||||
|
||||
gh_tag=${GITHUB_REF##*/}
|
||||
gh_branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
gh_type=$(echo "$GITHUB_REF" | awk -F / '{print $2}') #heads|tags|pull
|
||||
|
||||
if [[ -z $gh_tag ]];
|
||||
then
|
||||
export EDGETX_VERSION_SUFFIX=$gh_branch
|
||||
if [[ $gh_type = "tags" ]]; then
|
||||
# tags: refs/tags/<tag_name>
|
||||
gh_tag=${GITHUB_REF##*/}
|
||||
export EDGETX_VERSION_TAG=$gh_tag
|
||||
elif [[ $gh_type = "pull" ]]; then
|
||||
# pull: refs/pull/<pr_number>/merge
|
||||
gh_pull_number=PR$(echo "$GITHUB_REF" | awk -F / '{print $3}')
|
||||
export EDGETX_VERSION_SUFFIX=$gh_pull_number
|
||||
else
|
||||
export EDGETX_VERSION_SUFFIX=$gh_tag
|
||||
# heads: refs/heads/<branch_name>
|
||||
gh_branch=${GITHUB_REF##*/}
|
||||
export EDGETX_VERSION_SUFFIX=$gh_branch
|
||||
fi
|
||||
|
||||
: ${BUILD_TYPE:=Release}
|
||||
|
||||
Reference in New Issue
Block a user