Skip to content

Commit c78219d

Browse files
committed
add github releases
1 parent d903b71 commit c78219d

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.github/workflows/build_lcm.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@ name: LCM Build and Publish
33
on:
44
workflow_dispatch:
55
pull_request:
6+
paths:
7+
- "LCM/**"
8+
- .github/workflows/build_lcm.yaml
9+
- vcpkg-configuration.json
610
push:
711
branches:
812
- main
913
tags:
1014
- lcm@*
15+
paths:
16+
- "LCM/**"
17+
- .github/workflows/build_lcm.yaml
18+
- vcpkg-configuration.json
1119

1220
concurrency:
1321
group: ${{ github.workflow }}-${{ github.ref }}
@@ -32,6 +40,15 @@ jobs:
3240
run: |
3341
cpackget add LCM/HKMicroChip.HK32F030xMxx_DFP.1.0.17.pack
3442
43+
- name: Extract version from tag
44+
id: version-info
45+
if: startsWith(github.ref, 'refs/tags/lcm@')
46+
run: |
47+
echo "version=${GITHUB_REF#refs/tags/lcm@}" >> "$GITHUB_OUTPUT"
48+
echo "version-suffix=$(echo ${GITHUB_REF#refs/tags/lcm@} | tr -d '.')" >> "$GITHUB_OUTPUT"
49+
[[ "${GITHUB_REF#refs/tags/lcm@}" =~ ^[0-9\.]+$ ]] && echo "is-prerelease=false" >> "$GITHUB_OUTPUT" || echo "is-prerelease=true" >> "$GITHUB_OUTPUT"
50+
echo "CFLAGS=-DVERSION=\\\"$(echo ${GITHUB_REF#refs/tags/lcm@} | tr '.' '_')\\\"" >> "$GITHUB_ENV"
51+
3552
- name: Build
3653
working-directory: ./LCM
3754
run: |
@@ -50,3 +67,20 @@ jobs:
5067
with:
5168
name: firmware
5269
path: ./LCM/*.hex
70+
71+
- name: Rename release files
72+
if: startsWith(github.ref, 'refs/tags/lcm@')
73+
working-directory: ./LCM
74+
run: |
75+
for file in *.hex; do
76+
mv "$file" "${file%.hex}_${{ steps.version-info.outputs.version-suffix }}.hex"
77+
done
78+
79+
- name: Create release
80+
if: startsWith(github.ref, 'refs/tags/lcm@')
81+
uses: softprops/action-gh-release@v2
82+
with:
83+
name: "LCM v${{ steps.version-info.outputs.version }}"
84+
files: ./LCM/*.hex
85+
generate_release_notes: true
86+
prerelease: ${{ steps.version-info.outputs.is-prerelease }}

LCM/Code/App/vesc_uasrt.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
uint8_t VESC_RX_Buff[80];
77
uint8_t VESC_RX_Flag = 0;
88

9-
#define VERSION "2_2_0"
9+
#ifndef VERSION
10+
#define VERSION "0_0_0"
11+
#endif
1012
#define FIRMWARE_ID FIRMWARE_ID_PREFIX "_" VERSION
1113

1214
// Access ADC values here to determine riding state

0 commit comments

Comments
 (0)