Add merged binaries to release assets (#524)

This commit is contained in:
Pirata 2026-05-21 17:53:52 -03:00 committed by GitHub
parent 4170b86137
commit 895e6bc50d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 92 additions and 1 deletions

View File

@ -26,6 +26,13 @@ runs:
- name: 'Release' - name: 'Release'
shell: bash shell: bash
run: Buildscripts/release.sh ${{ inputs.board_id }} run: Buildscripts/release.sh ${{ inputs.board_id }}
- name: 'Merge binary'
shell: bash
run: |
python -m pip install esptool
cd release/Tactility-${{ inputs.board_id }}
bash ./merge.sh ${{ inputs.arch }}
mv Binaries/merged_binary.bin ../Tactility-${{ inputs.board_id }}.bin
- name: 'Upload Artifact: Release' - name: 'Upload Artifact: Release'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
@ -38,3 +45,9 @@ runs:
name: Tactility-${{ inputs.board_id }}-symbols name: Tactility-${{ inputs.board_id }}-symbols
path: release/Tactility-${{ inputs.board_id }}-symbols path: release/Tactility-${{ inputs.board_id }}-symbols
retention-days: 30 retention-days: 30
- name: 'Upload Artifact: Merged binary'
uses: actions/upload-artifact@v4
with:
name: Tactility-${{ inputs.board_id }}.bin
path: release/Tactility-${{ inputs.board_id }}.bin
retention-days: 30

View File

@ -191,7 +191,7 @@ def main(in_path: str, out_path: str, version: str):
devices=[] devices=[]
) )
for artifact_directory in artifact_directories: for artifact_directory in artifact_directories:
if artifact_directory.endswith("-symbols") or artifact_directory.startswith("TactilitySDK-"): if artifact_directory.endswith("-symbols") or artifact_directory.endswith(".bin") or artifact_directory.startswith("TactilitySDK-"):
continue continue
device_id = artifact_directory.removeprefix("Tactility-") device_id = artifact_directory.removeprefix("Tactility-")
if not device_id: if not device_id:

View File

@ -0,0 +1,26 @@
param(
# "--chip esp32s3" is irrelevant, just need to be added, fallback to "esp32s3"
[string]$chip = "esp32s3"
)
if ($null -eq (Get-Command "esptool" -ErrorAction SilentlyContinue))
{
Write-Host "Unable to find esptool in your path. Make sure you have Python installed and on your path. Then run `pip install esptool`."
exit 1
}
# Create merge command based on partitions
$json = Get-Content .\Binaries\flasher_args.json -Raw | ConvertFrom-Json
$jsonClean = $json.flash_files -replace '[\{\}\@\;]', ''
$jsonClean = $jsonClean -replace '[\=]', ' '
$mergeArgs = @('--chip', $chip, 'merge-bin', '--output', 'merged_binary.bin') + ($jsonClean -split '\s+' | Where-Object { $_ })
Push-Location Binaries
& esptool @mergeArgs
$exitCode = $LASTEXITCODE
Pop-Location
if ($exitCode -ne 0) {
exit $exitCode
}

View File

@ -0,0 +1,52 @@
#!/usr/bin/env bash
# Usage:
# merge.sh [chip]
#
# Arguments:
# chip - optional ESP32 SOC variant (e.g. esp32, esp32s3, esp32c6)
#
# Requirements:
# jq - run 'pip install jq'
# esptool.py - run 'pip install esptool'
#
# Documentation:
# https://docs.espressif.com/projects/esptool/en/latest/esp32/
#
# Source: https://stackoverflow.com/a/53798785
function is_bin_in_path {
builtin type -P "$1" &> /dev/null
}
function require_bin {
program=$1
if ! is_bin_in_path $program; then
exit 1
else
exit 0
fi
}
# Find either esptool (installed via system package manager) or esptool.py (installed via pip)
if ! is_bin_in_path esptool; then
if ! is_bin_in_path esptool.py; then
echo "\e[31m⚠ esptool not found! Install it from your package manager or install python and run 'pip install esptool'\e[0m"
exit 1
else
esptoolPath=esptool.py
fi
else
esptoolPath=esptool
fi
chip=${1:-esp32s3}
# Take the flash_arg file contents and join each line in the file into a single line
flash_args="$(tr '\n' ' ' < Binaries/flash_args)"
read -r -a flash_args_array <<< "$flash_args"
(
cd Binaries || exit 1
"$esptoolPath" --chip "$chip" merge-bin --output merged_binary.bin "${flash_args_array[@]}"
) || exit 1