Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions pio-scripts/set_nightly_version.py

This file was deleted.

23 changes: 21 additions & 2 deletions pio-scripts/set_version.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
Import('env')
Import('env') # PlatformIO-specific import
import json
import os
from datetime import datetime, timezone

PACKAGE_FILE = "package.json"

with open(PACKAGE_FILE, "r") as package:
version = json.load(package)["version"]
env.Append(BUILD_FLAGS=[f"-DWLED_VERSION={version}"])

# Handle nightly build
if os.environ.get('WLED_NIGHTLY_BUILD', '').lower() in ('true', '1', 'yes'):
# 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"-DWLED_BUILD_VERSION={version_code}"])
print(f"Nightly build: Setting VERSION to {version_code}")

# Update version tag: replace existing tag with "-nightly" or append "-nightly" if no tag
if "-" in version:
# Replace any existing tag with -nightly (handles multiple hyphens correctly)
version = version.rsplit("-", 1)[0] + "-nightly"
else:
# No tag present, append -nightly
version = version + "-nightly"
print(f"Nightly build: Using version string {version}")

env.Append(BUILD_FLAGS=[f"-DWLED_VERSION={version}"])
1 change: 0 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ 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
Expand Down