Skip to content

Commit e5793bc

Browse files
Copilotcziter15
andauthored
(feat) Add library version property to device portal with automatic version bumping (#54)
* Initial plan * (feat) Add library version property to device portal Co-authored-by: cziter15 <[email protected]> * (feat) Add automatic version bumping for KSF_LIBRARY_VERSION constant Co-authored-by: cziter15 <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: cziter15 <[email protected]>
1 parent 206214f commit e5793bc

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

.github/workflows/bump-and-release.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,18 @@ jobs:
8484
if [ -f library.json ]; then
8585
jq ".version = \"${NEW_VERSION}\"" library.json > tmp.json && mv tmp.json library.json
8686
fi
87+
- name: Bump ksConstants.h version
88+
env:
89+
NEW_VERSION: ${{ steps.determine-version.outputs.new_version }}
90+
run: |
91+
if [ -f src/ksf/ksConstants.h ]; then
92+
sed -i "s/^#define KSF_LIBRARY_VERSION \".*\"/#define KSF_LIBRARY_VERSION \"${NEW_VERSION}\"/" src/ksf/ksConstants.h
93+
fi
8794
- name: Commit & push version bump
8895
env:
8996
NEW_VERSION: ${{ steps.determine-version.outputs.new_version }}
9097
run: |
91-
git add library.properties library.json || true
98+
git add library.properties library.json src/ksf/ksConstants.h || true
9299
if git diff --cached --quiet; then
93100
echo "No changes to commit."
94101
else

src/ksf/comp/ksDevicePortal.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,9 @@ namespace ksf::comps
335335
response += PSTR("[{\"name\":\"MCU chip\",\"value\":\"");
336336
response += PSTR(HARDWARE " (");
337337
response += ksf::to_string(ESP.getCpuFreqMHz());
338-
response += PSTR(" MHz)\"},{\"name\":\"Flash chip\",\"value\":\"Vendor ID: ");
338+
response += PSTR(" MHz)\"},{\"name\":\"Library version\",\"value\":\"");
339+
response += PSTR(KSF_LIBRARY_VERSION);
340+
response += PSTR("\"},{\"name\":\"Flash chip\",\"value\":\"Vendor ID: ");
339341
response += ksf::to_string(ESP_getFlashVendor());
340342
response += PSTR(", size: ");
341343
response += ksf::to_string(ESP_getFlashSizeKB());

src/ksf/ksConstants.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
/*! Helper macro for init ks Framework. */
6565
#define KSF_FRAMEWORK_INIT() ksf::initializeFramework();
6666

67+
/*! Library version string. Auto-bumped by workflow. */
68+
#define KSF_LIBRARY_VERSION "1.0.33"
69+
6770
namespace ksf
6871
{
6972
namespace EOTAType

0 commit comments

Comments
 (0)