Skip to content

Commit 7976506

Browse files
authored
Add version to the binary during build (#12)
* add version to the binary during build * replace sed with perl (it is already installed on the runners)
1 parent 4eeba93 commit 7976506

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.github/workflows/release.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,14 @@ jobs:
5454
uses: actions/checkout@v3
5555
with:
5656
path: ${{ env.IMGTOOL_PACKING_PATH }}
57+
58+
- name: Set the version
59+
working-directory: ${{ env.IMGTOOL_PACKING_PATH }}/patches/
60+
run: perl -pi -e "s/ARDUINO_VERSION_PLACEHOLDER/${GITHUB_REF/refs\/tags\//}/g" 0008-Imgtool-Append-arduino-to-version-string.patch
5761

5862
- name: Apply patches
5963
working-directory: ${{ env.MCUBOOT_PATH }}/scripts/
60-
run: git apply -v "${{ env.IMGTOOL_PACKING_PATH }}/patches/"*
64+
run: git apply -v "${{ env.IMGTOOL_PACKING_PATH }}/patches/"*.patch
6165

6266
- name: Set up Python ${{ env.PYTHON_VERSION }}
6367
uses: actions/setup-python@v3
@@ -139,9 +143,13 @@ jobs:
139143
with:
140144
path: ${{ env.IMGTOOL_PACKING_PATH }}
141145

146+
- name: Set the version
147+
working-directory: ${{ env.IMGTOOL_PACKING_PATH }}/patches/
148+
run: perl -pi -e "s/ARDUINO_VERSION_PLACEHOLDER/${GITHUB_REF/refs\/tags\//}/g" 0008-Imgtool-Append-arduino-to-version-string.patch
149+
142150
- name: Apply patches
143151
working-directory: ${{ env.MCUBOOT_PATH }}/scripts/
144-
run: git apply -v "${{ env.IMGTOOL_PACKING_PATH }}/patches/"*
152+
run: git apply -v "${{ env.IMGTOOL_PACKING_PATH }}/patches/"*.patch
145153

146154
- name: Set up QEMU
147155
uses: docker/setup-qemu-action@v2

patches/0008-Imgtool-Append-arduino-to-version-string.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From bc65a76a48fe688bf9e9ce3efe90973976cf400a Mon Sep 17 00:00:00 2001
22
From: pennam <[email protected]>
33
Date: Mon, 18 Oct 2021 09:41:39 +0200
4-
Subject: [PATCH] Imgtool: Append -arduino to version string
4+
Subject: [PATCH] Imgtool: Add version placeholder, can be customized during build
55

66
---
77
scripts/imgtool/__init__.py | 2 +-
@@ -16,7 +16,7 @@ index ca43b8d..20769a4 100644
1616
# limitations under the License.
1717

1818
-imgtool_version = "1.8.0"
19-
+imgtool_version = "1.8.0-arduino"
19+
+imgtool_version = "ARDUINO_VERSION_PLACEHOLDER"
2020
--
2121
2.30.2
2222

0 commit comments

Comments
 (0)