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:
9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
@@ -4,10 +4,11 @@ name: PlatformIO CI
|
|||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
nightly_build:
|
||||||
description: 'Build VERSION in format yymmddb (optional, for nightly builds)'
|
description: 'Flag to indicate this is a nightly build'
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@ jobs:
|
|||||||
- name: Build firmware
|
- name: Build firmware
|
||||||
env:
|
env:
|
||||||
WLED_RELEASE: True
|
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 }}
|
run: pio run -e ${{ matrix.environment }}
|
||||||
- name: Rename Bin
|
- name: Rename Bin
|
||||||
run: mv -v .pio/build/${{ matrix.environment }}/firmware.bin firmware-${{ matrix.environment }}.bin
|
run: mv -v .pio/build/${{ matrix.environment }}/firmware.bin firmware-${{ matrix.environment }}.bin
|
||||||
|
|||||||
17
.github/workflows/nightly.yml
vendored
17
.github/workflows/nightly.yml
vendored
@@ -8,25 +8,10 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
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:
|
wled_build:
|
||||||
needs: calculate_version
|
|
||||||
uses: ./.github/workflows/build.yml
|
uses: ./.github/workflows/build.yml
|
||||||
with:
|
with:
|
||||||
version: ${{ needs.calculate_version.outputs.version }}
|
nightly_build: true
|
||||||
nightly:
|
nightly:
|
||||||
name: Deploy nightly
|
name: Deploy nightly
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
11
pio-scripts/set_nightly_version.py
Normal file
11
pio-scripts/set_nightly_version.py
Normal 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}")
|
||||||
|
|
||||||
@@ -224,6 +224,7 @@ ldscript_16m14m = eagle.flash.16m14m.ld
|
|||||||
[scripts_defaults]
|
[scripts_defaults]
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
pre:pio-scripts/set_version.py
|
pre:pio-scripts/set_version.py
|
||||||
|
pre:pio-scripts/set_nightly_version.py
|
||||||
pre:pio-scripts/build_ui.py
|
pre:pio-scripts/build_ui.py
|
||||||
pre:pio-scripts/conditional_usb_mode.py
|
pre:pio-scripts/conditional_usb_mode.py
|
||||||
pre:pio-scripts/set_repo.py
|
pre:pio-scripts/set_repo.py
|
||||||
|
|||||||
Reference in New Issue
Block a user