ADV2 support #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: LCM Build and Publish | |
on: | |
workflow_dispatch: | |
pull_request: | |
paths: | |
- "LCM/**" | |
- .github/workflows/build_lcm.yaml | |
- vcpkg-configuration.json | |
push: | |
branches: | |
- main | |
tags: | |
- lcm@* | |
paths: | |
- "LCM/**" | |
- .github/workflows/build_lcm.yaml | |
- vcpkg-configuration.json | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build LCM firmware | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup vcpkg environment | |
uses: ARM-software/cmsis-actions/vcpkg@v1 | |
- name: Activate Arm tool license | |
uses: ARM-software/cmsis-actions/armlm@v1 | |
- name: Register packs | |
run: | | |
cpackget add LCM/HKMicroChip.HK32F030xMxx_DFP.1.0.17.pack | |
- name: Extract version from tag | |
id: version-info | |
if: startsWith(github.ref, 'refs/tags/lcm@') | |
run: | | |
echo "version=${GITHUB_REF#refs/tags/lcm@}" >> "$GITHUB_OUTPUT" | |
echo "version-suffix=$(echo ${GITHUB_REF#refs/tags/lcm@} | tr -d '.')" >> "$GITHUB_OUTPUT" | |
[[ "${GITHUB_REF#refs/tags/lcm@}" =~ ^[0-9\.]+$ ]] && echo "is-prerelease=false" >> "$GITHUB_OUTPUT" || echo "is-prerelease=true" >> "$GITHUB_OUTPUT" | |
echo "CFLAGS=-DVERSION=\\\"$(echo ${GITHUB_REF#refs/tags/lcm@} | tr '.' '_')\\\"" >> "$GITHUB_ENV" | |
- name: Build | |
working-directory: ./LCM | |
run: | | |
./build.sh || true | |
missing=0 | |
[ ! -f lcm_adv2.hex ] && echo "::warning::ADV2 firmware failed to build" && missing=1 | |
[ ! -f lcm_adv_p42a.hex ] && echo "::warning::ADV-P42A firmware failed to build" && missing=1 | |
[ ! -f lcm_adv_dg40.hex ] && echo "::warning::ADV-DG40 firmware failed to build" && missing=1 | |
[ ! -f lcm_gtv.hex ] && echo "::warning::GTV firmware failed to build" && missing=1 | |
[ ! -f lcm_pintv.hex ] && echo "::warning::PintV firmware failed to build" && missing=1 | |
[ ! -f lcm_xrv.hex ] && echo "::warning::XRV firmware failed to build" && missing=1 | |
[ "$missing" -eq 0 ] && true || false | |
- name: Upload artifacts | |
if: ${{ !cancelled() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: firmware | |
path: ./LCM/*.hex | |
- name: Rename release files | |
if: startsWith(github.ref, 'refs/tags/lcm@') | |
working-directory: ./LCM | |
run: | | |
for file in *.hex; do | |
mv "$file" "${file%.hex}_${{ steps.version-info.outputs.version-suffix }}.hex" | |
done | |
- name: Create release | |
if: startsWith(github.ref, 'refs/tags/lcm@') | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: "LCM v${{ steps.version-info.outputs.version }}" | |
files: ./LCM/*.hex | |
generate_release_notes: true | |
prerelease: ${{ steps.version-info.outputs.is-prerelease }} |