Browse Source

workflow test

pull/421/head
lumapu 2 years ago
parent
commit
07b66635f3
  1. 7
      .github/workflows/compile_development.yml
  2. 56
      tools/esp8266/scripts/buildManifest.py
  3. 8
      tools/esp8266/scripts/getVersion.py

7
.github/workflows/compile_development.yml

@ -61,14 +61,19 @@ jobs:
env:
VERSION: ${{ steps.rename-binary-files.outputs.name }}
- name: Create Manifest
working-directory: tools/esp8266/scripts
run: python buildManifest.py
#run: zip --junk-paths ${{ steps.rename-binary-files.outputs.name }}.zip tools/esp8266/.pio/build/out/* tools/esp8266/User_Manual.md
- name: Create Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.rename-binary-files.outputs.name }}_dev_build
path: |
tools/esp8266/.pio/*/firmware/*
tools/*/firmware/*
tools/esp8266/User_Manual.md
tools/*/json/manifest.json
#./${{ steps.rename-binary-files.outputs.name }}.zip

56
tools/esp8266/scripts/buildManifest.py

@ -0,0 +1,56 @@
import os
from datetime import date
import json
def readVersion(path, infile):
f = open(path + infile, "r")
lines = f.readlines()
f.close()
today = date.today()
search = ["_MAJOR", "_MINOR", "_PATCH"]
version = today.strftime("%y%m%d") + "_ahoy_"
versionnumber = ""# "ahoy_v"
for line in lines:
if(line.find("VERSION_") != -1):
for s in search:
p = line.find(s)
if(p != -1):
version += line[p+13:].rstrip() + "."
versionnumber += line[p+13:].rstrip() + "."
return [versionnumber[:-1], version[:-1]]
def buildManifest(path, infile, outfile):
version = readVersion(path, infile)
sha = os.getenv("SHA",default="sha")
data = {}
data["name"] = "AhoyDTU - Development"
data["version"] = version[0]
data["new_install_prompt_erase"] = 1
data["builds"] = []
esp32 = {}
esp32["chipFamily"] = "ESP32"
esp32["parts"] = []
esp32["parts"].append({"path": "bootloader.bin", "offset": 4096})
esp32["parts"].append({"path": "partitions.bin", "offset": 32768})
esp32["parts"].append({"path": "ota.bin", "offset": 57344})
esp32["parts"].append({"path": version[1] + "_esp32_" + sha + ".bin", "offset": 65536})
data["builds"].append(esp32)
esp8266 = {}
esp8266["chipFamily"] = "ESP8266"
esp8266["parts"] = []
esp8266["parts"].append({"path": version[1] + "_esp8266_" + sha + ".bin", "offset": 0})
data["builds"].append(esp8266)
jsonString = json.dumps(data, indent=2)
os.mkdir(path + "json/")
fp = open(path + "json/" + outfile, "w")
fp.write(jsonString)
fp.close()
buildManifest("../", "defines.h", "manifest.json")

8
tools/esp8266/scripts/getVersion.py

@ -18,21 +18,21 @@ def readVersion(path, infile):
version += line[p+13:].rstrip() + "."
versionnumber += line[p+13:].rstrip() + "."
os.mkdir(path + ".pio/build/firmware/")
os.mkdir(path + "firmware/")
sha = os.getenv("SHA",default="sha")
versionout = version[:-1] + "_esp8266_" + sha + ".bin"
src = path + ".pio/build/esp8266-release/firmware.bin"
dst = path + ".pio/build/firmware/" + versionout
dst = path + "firmware/" + versionout
os.rename(src, dst)
versionout = version[:-1] + "_esp8266_1m_" + sha + ".bin"
src = path + ".pio/build/esp8266-1m-release/firmware.bin"
dst = path + ".pio/build/firmware/" + versionout
dst = path + "firmware/" + versionout
os.rename(src, dst)
versionout = version[:-1] + "_esp32_" + sha + ".bin"
src = path + ".pio/build/esp32-wroom32-release/firmware.bin"
dst = path + ".pio/build/firmware/" + versionout
dst = path + "firmware/" + versionout
os.rename(src, dst)
print("::set-output name=name::" + versionnumber[:-1] )

Loading…
Cancel
Save