Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
f4329a85eThis file is pinned to the selected release. Download the original to open it in your design tool.
name: Release
on:
push:
tags: [ 'v*' ]
jobs:
release:
runs-on: ubuntu-latest
name: Draft GitHub Release
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11.7'
- name: Cache PlatformIO
uses: actions/cache@v5
with:
path: |
~/.platformio
~/.cache/pip
key: ${{ runner.os }}-platformio-${{ hashFiles('**/platformio.ini') }}
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install platformio
- name: Extract version from constants.h
id: version
working-directory: source
run: |
VERSION=$(grep -oP 'FIRMWARE_BUILD_VERSION_MAJOR "\K\w+' include/constants.h).$(grep -oP 'FIRMWARE_BUILD_VERSION_MINOR "\K\w+' include/constants.h).$(grep -oP 'FIRMWARE_BUILD_VERSION_PATCH "\K\w+' include/constants.h)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "📌 constants.h version: $VERSION"
- name: Verify tag matches constants.h
run: |
TAG="${GITHUB_REF#refs/tags/v}"
CONST="${{ steps.version.outputs.VERSION }}"
echo "Tag: v$TAG"
echo "constants.h: $CONST"
if [ "$TAG" != "$CONST" ]; then
echo "::error::Tag v$TAG does not match constants.h version $CONST. Bump constants.h before tagging."
exit 1
fi
echo "✅ Tag and constants.h agree"
# One binary per product: the PSRAM mode (quad on Home, octal on Home Pro) is fixed at
# compile time, so neither image can boot on the other board.
- name: Build esp32s3-prod and esp32s3-prod-pro
working-directory: source
run: |
echo "🏗️ Building firmware for esp32s3-prod and esp32s3-prod-pro..."
pio run -e esp32s3-prod -e esp32s3-prod-pro
echo "✅ Build completed"
- name: Prepare release artifacts
working-directory: source
run: |
mkdir -p release
cp .pio/build/esp32s3-prod/firmware.bin release/energyme_home_${{ steps.version.outputs.VERSION }}.bin
cp .pio/build/esp32s3-prod/firmware.elf release/energyme_home_${{ steps.version.outputs.VERSION }}.elf
cp .pio/build/esp32s3-prod/bootloader.bin release/energyme_home_${{ steps.version.outputs.VERSION }}_bootloader.bin
cp .pio/build/esp32s3-prod/partitions.bin release/energyme_home_${{ steps.version.outputs.VERSION }}_partitions.bin
# The names carry the product token the firmware's upload gate and release picker
# match on (FIRMWARE_ARTIFACT_TOKEN_* in hardware_profile.h).
cp .pio/build/esp32s3-prod-pro/firmware.bin release/energyme_homepro_${{ steps.version.outputs.VERSION }}.bin
cp .pio/build/esp32s3-prod-pro/firmware.elf release/energyme_homepro_${{ steps.version.outputs.VERSION }}.elf
cp .pio/build/esp32s3-prod-pro/bootloader.bin release/energyme_homepro_${{ steps.version.outputs.VERSION }}_bootloader.bin
cp .pio/build/esp32s3-prod-pro/partitions.bin release/energyme_homepro_${{ steps.version.outputs.VERSION }}_partitions.bin
- name: Create draft GitHub Release
uses: softprops/action-gh-release@v3
with:
draft: true
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
files: |
source/release/energyme_home_${{ steps.version.outputs.VERSION }}.bin
source/release/energyme_home_${{ steps.version.outputs.VERSION }}.elf
source/release/energyme_home_${{ steps.version.outputs.VERSION }}_bootloader.bin
source/release/energyme_home_${{ steps.version.outputs.VERSION }}_partitions.bin
# A separate step, after the Home assets exist, on purpose: Home firmware up to 2.3.x
# offers the FIRST asset whose name contains ".bin" and "energyme_home" as the update,
# and nothing on those devices checks the product. The Pro names match that test too,
# so they must never be listed ahead of the Home image (they also sort after it by name).
- name: Add the Home Pro assets to the draft
uses: softprops/action-gh-release@v3
with:
draft: true
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
files: |
source/release/energyme_homepro_${{ steps.version.outputs.VERSION }}.bin
source/release/energyme_homepro_${{ steps.version.outputs.VERSION }}.elf
source/release/energyme_homepro_${{ steps.version.outputs.VERSION }}_bootloader.bin
source/release/energyme_homepro_${{ steps.version.outputs.VERSION }}_partitions.bin
- name: Release summary
run: |
echo "### 🚀 Draft Release Created" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Tag**: \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY
echo "**Version**: \`${{ steps.version.outputs.VERSION }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "📄 Assets:" >> $GITHUB_STEP_SUMMARY
echo " - \`energyme_home_${{ steps.version.outputs.VERSION }}.bin\`" >> $GITHUB_STEP_SUMMARY
echo " - \`energyme_home_${{ steps.version.outputs.VERSION }}.elf\`" >> $GITHUB_STEP_SUMMARY
echo " - \`energyme_home_${{ steps.version.outputs.VERSION }}_bootloader.bin\`" >> $GITHUB_STEP_SUMMARY
echo " - \`energyme_home_${{ steps.version.outputs.VERSION }}_partitions.bin\`" >> $GITHUB_STEP_SUMMARY
echo " - \`energyme_homepro_${{ steps.version.outputs.VERSION }}.bin\`" >> $GITHUB_STEP_SUMMARY
echo " - \`energyme_homepro_${{ steps.version.outputs.VERSION }}.elf\`" >> $GITHUB_STEP_SUMMARY
echo " - \`energyme_homepro_${{ steps.version.outputs.VERSION }}_bootloader.bin\`" >> $GITHUB_STEP_SUMMARY
echo " - \`energyme_homepro_${{ steps.version.outputs.VERSION }}_partitions.bin\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "👉 Open the draft on GitHub, write notes, optionally tick prerelease, then Publish." >> $GITHUB_STEP_SUMMARY