Skip to content

Commit

Permalink
Set WLED_VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
netmindz committed Oct 10, 2024
1 parent 32657cf commit bba2154
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/wled-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ jobs:
python-version: '3.9'
- name: Install PlatformIO
run: pip install -r requirements.txt
- name: set WLED_VERSION
if: startsWith(github.ref, 'refs/tags/')
run: echo "WLED_VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_ENV
- name: Build firmware
env:
WLED_RELEASE: True
Expand Down
11 changes: 8 additions & 3 deletions pio-scripts/set_version.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
Import('env')
import json
import os

PACKAGE_FILE = "package.json"

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

env.Append(BUILD_FLAGS=[f"-DWLED_VERSION={version}"])

0 comments on commit bba2154

Please sign in to comment.