This commit is contained in:
@@ -0,0 +1,67 @@
|
|||||||
|
name: Build and Release Firmware
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
env:
|
||||||
|
TARGET: thumbv8m.main-none-eabihf
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Rust Toolchain
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
targets: ${{ env.TARGET }}
|
||||||
|
|
||||||
|
- name: Install llvm-tools / objcopy
|
||||||
|
run: rustup component add llvm-tools-preview
|
||||||
|
|
||||||
|
- name: Build Firmware Binaries
|
||||||
|
run: |
|
||||||
|
cd firmware
|
||||||
|
|
||||||
|
# Define the target features for each variant
|
||||||
|
declare -A VARIANTS=(
|
||||||
|
["cs4398"]="cs4398,hid"
|
||||||
|
["ak4490"]="ak4490,hid"
|
||||||
|
["evk"]="evk,hid"
|
||||||
|
)
|
||||||
|
|
||||||
|
mkdir -p ../dist
|
||||||
|
|
||||||
|
for name in "${!VARIANTS[@]}"; do
|
||||||
|
features="${VARIANTS[$name]}"
|
||||||
|
echo "Building variant: $name with features: $features"
|
||||||
|
|
||||||
|
# 1. Compile release binary
|
||||||
|
cargo build --release --target ${{ env.TARGET }} --no-default-features --features "$features"
|
||||||
|
|
||||||
|
# 2. Extract paths
|
||||||
|
ELF_PATH="../target/${{ env.TARGET }}/release/guac"
|
||||||
|
HEX_PATH="../target/${{ env.TARGET }}/release/guac-${name}.hex"
|
||||||
|
RENAMED_ELF="../target/${{ env.TARGET }}/release/guac-${name}.elf"
|
||||||
|
|
||||||
|
# 3. Create .hex file using llvm-objcopy from Rust tools
|
||||||
|
rust-objcopy -O ihex "$ELF_PATH" "$HEX_PATH"
|
||||||
|
cp "$ELF_PATH" "$RENAMED_ELF"
|
||||||
|
|
||||||
|
# 4. Package ELF and HEX into a target-specific ZIP
|
||||||
|
ZIP_NAME="guac-firmware-${name}.zip"
|
||||||
|
zip -j "../dist/${ZIP_NAME}" "$RENAMED_ELF" "$HEX_PATH"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Create Gitea Release
|
||||||
|
uses: gitea/release-action@v1
|
||||||
|
with:
|
||||||
|
key: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
files: dist/*.zip
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
Reference in New Issue
Block a user