Build and Release ESP32 Firmware #70
This file contains 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: Build and Release ESP32 Firmware | |
on: | |
workflow_dispatch: # Manual trigger only | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
board: [NERDQAXEPLUS, NERDOCTAXEPLUS, NERDQAXEPLUS2] | |
include: | |
- board: NERDQAXEPLUS | |
upload_www: true | |
label: NerdQAxe+ | |
- board: NERDOCTAXEPLUS | |
upload_www: false | |
label: NerdOCTAXE+ | |
- board: NERDQAXEPLUS2 | |
upload_www: false | |
label: NerdQAxe++ | |
- board: NERDAXE | |
upload_www: false | |
label: NerdAxe | |
- board: NERDOCTAXEGAMMA | |
upload_www: false | |
label: NerdOCTAXE-Gamma | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Get Version Tag | |
id: version_tag | |
run: | | |
git fetch --tags # Ensure all tags are fetched | |
version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD) | |
echo "VERSION_TAG=${version}" >> $GITHUB_ENV | |
echo "${version}" > version.txt | |
echo "VERSION_TAG=${version}" | |
- name: Set Target | |
run: | | |
# Run the Docker container to build the project | |
docker run --rm --user root -e BOARD=${{ matrix.board }} -v $PWD:/home/builder/project \ | |
shufps/esp-idf-builder:0.0.1 idf.py set-target esp32s3 | |
- name: Compile Binaries | |
run: | | |
# Run the Docker container to build the project with BOARD environment variable | |
docker run --rm --user root -e BOARD=${{ matrix.board }} -v $PWD:/home/builder/project \ | |
shufps/esp-idf-builder:0.0.1 idf.py build | |
- name: Merge Binaries | |
run: | | |
docker run --rm --user root -v $PWD:/home/builder/project \ | |
shufps/esp-idf-builder:0.0.1 esptool.py --chip esp32s3 merge_bin --flash_mode dio --flash_size 16MB --flash_freq 80m \ | |
0x0 build/bootloader/bootloader.bin \ | |
0x8000 build/partition_table/partition-table.bin \ | |
0x10000 build/esp-miner.bin \ | |
0x410000 build/www.bin \ | |
0xf10000 build/ota_data_initial.bin \ | |
-o esp-miner-factory-${{ matrix.label }}-${{ env.VERSION_TAG }}.bin | |
- name: Rename Build Artifacts | |
run: | | |
sudo mv build/esp-miner.bin build/esp-miner-${{ matrix.label }}.bin | |
- name: Create files list | |
run: | | |
echo "esp-miner-factory-${{ matrix.label }}-${{ env.VERSION_TAG }}.bin" > file_list.txt | |
echo "build/esp-miner-${{ matrix.label }}.bin" >> file_list.txt | |
if [ "${{ matrix.upload_www }}" == "true" ]; then | |
echo "build/www.bin" >> file_list.txt | |
fi | |
- name: Set files variable | |
id: set_files_var | |
run: echo "files=$(cat file_list.txt | tr '\n' ',')" >> $GITHUB_ENV | |
- name: Upload to Existing Release | |
if: always() | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ${{ env.files }} | |
tag_name: ${{ env.VERSION_TAG }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |