From cdcec22e609688812bf0f5ac303cc9c6970efb23 Mon Sep 17 00:00:00 2001 From: ReFil <31960031+ReFil@users.noreply.github.com> Date: Thu, 16 Nov 2023 07:49:39 +0000 Subject: Version compiled FW with automatic macro (#267) * Version compiled FW with hash Auto generates a macro to type out version info, local and github compilation now includes commit hash and timestamp in final uf2 files * Fix local builds makefile doesn't like the script returning the macro, directed to null for local builds as version.dtsi file accessible --- .github/workflows/build.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 35a2fe9..23c3edf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,15 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + - name: Get version data + id: get_info + run: | + timestamp=$(date +"%Y%m%d%H%M") + commit=$(echo "${{ github.sha }}" | cut -c1-7) + file_prefix=$timestamp-$commit + branch_name=$(echo "${{ github.ref }}" | awk -F'/' '{print $3}' | cut -c1-4) + echo "file_prefix=$file_prefix" >> $GITHUB_OUTPUT + bin/get_version.sh $branch_name $commit - name: Cache west modules uses: actions/cache@v3 env: @@ -42,11 +51,11 @@ jobs: - name: Adv360 Right Kconfig file run: grep -vE '(^#|^$)' build/right/zephyr/.config - name: Rename zmk.uf2 - run: cp build/left/zephyr/zmk.uf2 left.uf2 && cp build/right/zephyr/zmk.uf2 right.uf2 + run: cp build/left/zephyr/zmk.uf2 ${{ steps.get_info.outputs.file_prefix }}-left.uf2 && cp build/right/zephyr/zmk.uf2 ${{ steps.get_info.outputs.file_prefix }}-right.uf2 - name: Archive (Adv360) uses: actions/upload-artifact@v3 with: name: firmware path: | - left.uf2 - right.uf2 + ${{ steps.get_info.outputs.file_prefix }}-left.uf2 + ${{ steps.get_info.outputs.file_prefix }}-right.uf2 -- cgit v1.2.3