File tree Expand file tree Collapse file tree 4 files changed +42
-2
lines changed Expand file tree Collapse file tree 4 files changed +42
-2
lines changed Original file line number Diff line number Diff line change 3535 yes | ./extra/bootstrap.sh -o=--filter=tree:0
3636 echo "CORE_HASH=$(git describe --always)" >> "$GITHUB_ENV"
3737 echo "ALL_BOARD_DATA=$(extra/get_board_details.sh | jq -c 'sort_by(.variant)')" >> "$GITHUB_ENV"
38+ echo "## Building \`$(extra/get_core_version.sh)\`" >> "$GITHUB_STEP_SUMMARY"
3839
3940 - name : Map output packages
4041 # needs the above env vars to be usable
Original file line number Diff line number Diff line change 1616
1717JSON_TEMPLATE=" extra/zephyr-core-template.json"
1818cat $JSON_TEMPLATE | sed \
19- -e " s/__CORE_TAG__/$CORE_TAG /" \
19+ -e " s/__CORE_TAG__/$( extra/get_core_version.sh ) /" \
2020 -e " s/__ARTIFACT_FILE__/$( basename $ARTIFACT_FILE ) /" \
2121 -e " s/__ARTIFACT_HASH__/$( sha256sum $ARTIFACT_FILE | awk ' {print $1}' ) /" \
2222 -e " s/__ARTIFACT_SIZE__/$( stat -c %s $ARTIFACT_FILE ) /" | jq .
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # This script generates a SemVer-compatible version number based on Git tags.
4+ #
5+ # If the current commit is tagged, it returns that version. If not, it
6+ # generates a version string based on the next patch number and the current
7+ # commit hash.
8+ #
9+ # If the tag is a simple "<maj>.<min>.<patch>", git describe will output:
10+ #
11+ # <maj>.<min>.<patch>-<number-of-commits-since-tag>-g<commit-hash-dirty>
12+ #
13+ # The regexp splits the patch number, awk converts the tokens to:
14+ #
15+ # <maj>.<min>.<next-patch>-0.dev+<commit-hash-dirty>
16+ #
17+ # If the tag refers to a pre-release, like "<maj>.<min>.<patch>-<extra-stuff>",
18+ # sed will output a total of 4 arguments and the format of the final awk output
19+ # will be:
20+ #
21+ # <maj>.<min>.<patch>-<extra-stuff>-0.dev+<commit-hash-dirty>
22+ #
23+ # These are among the lowest possible SemVer versions greater than the last
24+ # tagged version.
25+ #
26+ # If there are no tags at all (for example when run in a fork etc), it defaults
27+ # to "9.9.9-<date>+<commit-hash-dirty>".
28+
29+ VERSION=$( git describe --tags --exact-match 2> /dev/null)
30+ if [ -z " $VERSION " ]; then
31+ VERSION=$( git describe --tags --dirty 2> /dev/null |
32+ sed ' s/\.\([[:digit:]]\+\)\(-.*\)*-[[:digit:]]\+-g/ \1 \2 /' |
33+ awk ' { if (NF==3) { print $1 "." ($2+1) "-0.dev+" $3 } else { print $1 "." $2 $3 "-0.dev+" $4 }}' )
34+ if [ -z " $VERSION " ]; then
35+ VERSION=" 9.9.9-$( date ' +%Y%m%d-%H%M%S' ) +$( git describe --always --dirty) "
36+ fi
37+ fi
38+ echo $VERSION
Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ OUTPUT_FILE=${2:-distrib/${PACKAGE}-${VERSION}.tar.bz2}
1818
1919# create a temporary platform.txt file with the correct version
2020TEMP_PLATFORM=$( mktemp -p . | sed ' s/\.\///' )
21- sed -e " s/^version=.*/version=${VERSION} /" platform.txt > ${TEMP_PLATFORM}
21+ cat platform.txt > ${TEMP_PLATFORM}
22+ sed -ie " s/^version=.*/version=$( extra/get_core_version.sh) /" ${TEMP_PLATFORM}
2223
2324declutter_file () {
2425 [ -f " $1 " ] || return 0
You can’t perform that action at this time.
0 commit comments