Skip to content

Commit 220297b

Browse files
committed
package_core: mark a release with tags when available
Use the tag name to mark the release if it exists, otherwise fall back to the commit hash. This ultimately only affects the version in the JSON, not the generated tarball file, to allow sync-zephyr-artifacts to work with any Git commit. Signed-off-by: Luca Burelli <[email protected]>
1 parent d3690c9 commit 220297b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

.github/workflows/package_core.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Initialize Zephyr environment
3131
run: |
3232
yes | ./extra/bootstrap.sh -o=--filter=tree:0
33-
echo "CORE_TAG=$(git describe --always)" >> "$GITHUB_ENV"
33+
echo "CORE_TAG=$(git describe --tags --exact-match || git describe --always)" >> "$GITHUB_ENV"
3434
echo "CORE_ARTIFACT=ArduinoCore-zephyr-$(git describe --always)" >> "$GITHUB_ENV"
3535
echo "BOARD_VARIANTS=$(extra/get_board_details.sh | jq -cr 'sort_by(.variant)')" >> "$GITHUB_ENV"
3636
@@ -46,7 +46,7 @@ jobs:
4646
4747
- name: Package core
4848
run: |
49-
./extra/package_core.sh ${{ env.CORE_TAG }}
49+
./extra/package_core.sh ${{ env.CORE_TAG }} distrib/${{ env.CORE_ARTIFACT }}.tar.bz2
5050
5151
- name: Archive core
5252
uses: actions/upload-artifact@v4

extra/package_core.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44

55
if [ -z "$1" ]; then
6-
echo "Usage: $0 VERSION"
6+
echo "Usage: $0 VERSION [OUTPUT_FILE]"
77
exit 1
88
fi
99

@@ -14,6 +14,7 @@ fi
1414

1515
PACKAGE=ArduinoCore-zephyr
1616
VERSION=$1
17+
OUTPUT_FILE=${2:-distrib/${PACKAGE}-${VERSION}.tar.bz2}
1718

1819
# create a temporary platform.txt file with the correct version
1920
TEMP_PLATFORM=$(mktemp -p . | sed 's/\.\///')
@@ -32,6 +33,6 @@ extra/get_board_details.sh | jq -cr '.[]' | while read -r item; do
3233
ls firmwares/zephyr-${variant}.* >> ${TEMP_LIST}
3334
done
3435
cat ${TEMP_LIST}
35-
mkdir -p distrib
36-
tar -cjhf distrib/${PACKAGE}-${VERSION}.tar.bz2 -X extra/package_core.exc -T ${TEMP_LIST} --transform "s,${TEMP_PLATFORM},platform.txt," --transform "s,^,${PACKAGE}/,"
36+
mkdir -p $(dirname ${OUTPUT_FILE})
37+
tar -cjhf ${OUTPUT_FILE} -X extra/package_core.exc -T ${TEMP_LIST} --transform "s,${TEMP_PLATFORM},platform.txt," --transform "s,^,${PACKAGE}/,"
3738
rm -f ${TEMP_LIST} ${TEMP_PLATFORM}

0 commit comments

Comments
 (0)