Implement nightly VERSION automation using PlatformIO script

- Created pio-scripts/set_nightly_version.py following existing set_version.py pattern
- Script sets VERSION to yymmddb format with build number 0 for nightly builds
- Modified build.yml to accept nightly_build boolean input
- Modified nightly.yml to pass nightly_build=true flag
- Added set_nightly_version.py to platformio.ini extra_scripts
- Uses WLED_NIGHTLY_BUILD environment variable to conditionally set VERSION

Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-15 10:11:48 +00:00
parent 8c70acad65
commit 39899c1061
4 changed files with 18 additions and 20 deletions

View File

@@ -4,10 +4,11 @@ name: PlatformIO CI
on:
workflow_call:
inputs:
version:
description: 'Build VERSION in format yymmddb (optional, for nightly builds)'
nightly_build:
description: 'Flag to indicate this is a nightly build'
required: false
type: string
type: boolean
default: false
jobs:
@@ -67,7 +68,7 @@ jobs:
- name: Build firmware
env:
WLED_RELEASE: True
PLATFORMIO_BUILD_FLAGS: ${{ inputs.version && format('-D VERSION={0}', inputs.version) || '' }}
WLED_NIGHTLY_BUILD: ${{ inputs.nightly_build && 'true' || 'false' }}
run: pio run -e ${{ matrix.environment }}
- name: Rename Bin
run: mv -v .pio/build/${{ matrix.environment }}/firmware.bin firmware-${{ matrix.environment }}.bin

View File

@@ -8,25 +8,10 @@ on:
workflow_dispatch:
jobs:
calculate_version:
name: Calculate VERSION
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Calculate VERSION
id: version
run: |
# VERSION format: yymmddb (b = daily build number, set to 1 for nightly)
VERSION=$(date -u +"%y%m%d")1
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Calculated VERSION: $VERSION"
wled_build:
needs: calculate_version
uses: ./.github/workflows/build.yml
with:
version: ${{ needs.calculate_version.outputs.version }}
nightly_build: true
nightly:
name: Deploy nightly
runs-on: ubuntu-latest

View File

@@ -0,0 +1,11 @@
Import('env')
import os
from datetime import datetime, timezone
# Only set VERSION if this is a nightly build (indicated by environment variable)
if os.environ.get('WLED_NIGHTLY_BUILD') == 'true':
# VERSION format: yymmddb (b = build number, 0 for nightly)
version_code = datetime.now(timezone.utc).strftime("%y%m%d") + "0"
env.Append(BUILD_FLAGS=[f"-DVERSION={version_code}"])
print(f"Nightly build: Setting VERSION to {version_code}")

View File

@@ -224,6 +224,7 @@ ldscript_16m14m = eagle.flash.16m14m.ld
[scripts_defaults]
extra_scripts =
pre:pio-scripts/set_version.py
pre:pio-scripts/set_nightly_version.py
pre:pio-scripts/build_ui.py
pre:pio-scripts/conditional_usb_mode.py
pre:pio-scripts/set_repo.py