mirror of
https://github.com/wled/WLED.git
synced 2025-07-13 13:56:35 +00:00
add bin.gz firmware for ESP02 to artifacs (#4)
This commit is contained in:
parent
b66a038a2f
commit
c41c71c8c1
5
.github/workflows/wled-ci.yml
vendored
5
.github/workflows/wled-ci.yml
vendored
@ -59,7 +59,9 @@ jobs:
|
|||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: firmware-${{ matrix.environment }}
|
name: firmware-${{ matrix.environment }}
|
||||||
path: build_output/release/*.bin
|
path: |
|
||||||
|
build_output/release/*.bin
|
||||||
|
build_output/release/*_ESP02.bin.gz
|
||||||
release:
|
release:
|
||||||
name: Create Release
|
name: Create Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -75,3 +77,4 @@ jobs:
|
|||||||
draft: True
|
draft: True
|
||||||
files: |
|
files: |
|
||||||
*.bin
|
*.bin
|
||||||
|
*.bin.gz
|
||||||
|
@ -22,6 +22,16 @@ def _create_dirs(dirs=["firmware", "map"]):
|
|||||||
if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)):
|
if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)):
|
||||||
os.mkdir("{}{}".format(OUTPUT_DIR, d))
|
os.mkdir("{}{}".format(OUTPUT_DIR, d))
|
||||||
|
|
||||||
|
def create_release(source):
|
||||||
|
release_name = _get_cpp_define_value(env, "WLED_RELEASE_NAME")
|
||||||
|
if release_name:
|
||||||
|
_create_dirs(["release"])
|
||||||
|
version = _get_cpp_define_value(env, "WLED_VERSION")
|
||||||
|
# get file extension of source file (.bin or .bin.gz)
|
||||||
|
ext = source.split(".", 1)[1]
|
||||||
|
release_file = "{}release{}WLED_{}_{}.{}".format(OUTPUT_DIR, os.path.sep, version, release_name, ext)
|
||||||
|
shutil.copy(source, release_file)
|
||||||
|
|
||||||
def bin_rename_copy(source, target, env):
|
def bin_rename_copy(source, target, env):
|
||||||
_create_dirs()
|
_create_dirs()
|
||||||
variant = env["PIOENV"]
|
variant = env["PIOENV"]
|
||||||
@ -30,14 +40,6 @@ def bin_rename_copy(source, target, env):
|
|||||||
map_file = "{}map{}{}.map".format(OUTPUT_DIR, os.path.sep, variant)
|
map_file = "{}map{}{}.map".format(OUTPUT_DIR, os.path.sep, variant)
|
||||||
bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant)
|
bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant)
|
||||||
|
|
||||||
release_name = _get_cpp_define_value(env, "WLED_RELEASE_NAME")
|
|
||||||
|
|
||||||
if release_name:
|
|
||||||
_create_dirs(["release"])
|
|
||||||
version = _get_cpp_define_value(env, "WLED_VERSION")
|
|
||||||
release_file = "{}release{}WLED_{}_{}.bin".format(OUTPUT_DIR, os.path.sep, version, release_name)
|
|
||||||
shutil.copy(str(target[0]), release_file)
|
|
||||||
|
|
||||||
# check if new target files exist and remove if necessary
|
# check if new target files exist and remove if necessary
|
||||||
for f in [map_file, bin_file]:
|
for f in [map_file, bin_file]:
|
||||||
if os.path.isfile(f):
|
if os.path.isfile(f):
|
||||||
@ -46,6 +48,8 @@ def bin_rename_copy(source, target, env):
|
|||||||
# copy firmware.bin to firmware/<variant>.bin
|
# copy firmware.bin to firmware/<variant>.bin
|
||||||
shutil.copy(str(target[0]), bin_file)
|
shutil.copy(str(target[0]), bin_file)
|
||||||
|
|
||||||
|
create_release(bin_file)
|
||||||
|
|
||||||
# copy firmware.map to map/<variant>.map
|
# copy firmware.map to map/<variant>.map
|
||||||
if os.path.isfile("firmware.map"):
|
if os.path.isfile("firmware.map"):
|
||||||
shutil.move("firmware.map", map_file)
|
shutil.move("firmware.map", map_file)
|
||||||
@ -66,4 +70,6 @@ def bin_gzip(source, target, env):
|
|||||||
with gzip.open(gzip_file, "wb", compresslevel = 9) as f:
|
with gzip.open(gzip_file, "wb", compresslevel = 9) as f:
|
||||||
shutil.copyfileobj(fp, f)
|
shutil.copyfileobj(fp, f)
|
||||||
|
|
||||||
|
create_release(gzip_file)
|
||||||
|
|
||||||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_rename_copy, bin_gzip])
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_rename_copy, bin_gzip])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user