Skip to content

Commit ca03705

Browse files
author
Minh Hai Chu
authored
Add versioning to pipelines
1 parent 67acd91 commit ca03705

File tree

1 file changed

+55
-6
lines changed

1 file changed

+55
-6
lines changed

.github/workflows/cicd.yml

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
- uses: actions/checkout@v4
2121
with:
2222
fetch-depth: 0
23+
submodules: recursive
2324

2425
- name: Cache ESP-IDF Installation
2526
id: cache-esp-idf
@@ -55,17 +56,65 @@ jobs:
5556
cd $GITHUB_WORKSPACE/target_sw/app/micro_kws_esp32devboard_perf
5657
# Force full clean to ensure sdkconfig.defaults is used
5758
idf.py fullclean
58-
# Set target to ESP32-C3 (RISC-V)
5959
idf.py set-target esp32c3
60-
# Verify the config was set correctly
61-
echo "Checking MLONMCU_FRAMEWORK setting:"
62-
grep "CONFIG_MLONMCU_FRAMEWORK" sdkconfig || echo "Not found in sdkconfig"
63-
grep "CONFIG_MLONMCU_FRAMEWORK" sdkconfig.defaults || echo "Not found in defaults"
6460
# Build with fresh config
6561
idf.py build
6662
6763
- name: Upload firmware as artifact
6864
uses: actions/upload-artifact@v4
6965
with:
7066
name: esp32-firmware
71-
path: target_sw/app/micro_kws_esp32devboard_perf/build/app.bin
67+
path: target_sw/app/micro_kws_esp32devboard_perf/build/app.bin
68+
69+
bump-version:
70+
runs-on: ubuntu-latest
71+
needs: build-firmware
72+
outputs:
73+
version: ${{ steps.set-version.outputs.version }}
74+
steps:
75+
- name: Checkout repository
76+
uses: actions/checkout@v4
77+
with:
78+
fetch-depth: 0
79+
80+
- name: Bump patch version
81+
id: set-version
82+
run: |
83+
apt-get update && apt-get install -y jq
84+
85+
MAJOR=$(jq -r '.major' version.json)
86+
MINOR=$(jq -r '.minor' version.json)
87+
PATCH=$(jq -r '.patch' version.json)
88+
89+
PATCH=$((PATCH+1))
90+
91+
# Handle rollover: patch -> minor -> major
92+
if [ "$PATCH" -gt 10 ]; then
93+
PATCH=0
94+
MINOR=$((MINOR+1))
95+
fi
96+
97+
if [ "$MINOR" -gt 10 ]; then
98+
MINOR=0
99+
MAJOR=$((MAJOR+1))
100+
fi
101+
102+
# Write back into version.json
103+
jq \
104+
--argjson major $MAJOR \
105+
--argjson minor $MINOR \
106+
--argjson patch $PATCH \
107+
'{major:$major, minor:$minor, patch:$patch}' \
108+
version.json > version.tmp && mv version.tmp version.json
109+
110+
# Export version string
111+
VERSION="$MAJOR.$MINOR.$PATCH"
112+
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
113+
114+
- name: Commit updated version.json
115+
run: |
116+
git config user.name "Hai Chu"
117+
git config user.email "[email protected]"
118+
git add version.json
119+
git commit -m "Bump version to ${{ steps.set-version.outputs.version }} [skip ci]"
120+
git push

0 commit comments

Comments
 (0)