mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-21 04:06:29 +01:00
Merge pull request #50 from jonasniesner/master
Update release pipeline
This commit is contained in:
100
.github/workflows/release.yml
vendored
100
.github/workflows/release.yml
vendored
@@ -26,11 +26,35 @@ jobs:
|
||||
|
||||
- name: Install esptool
|
||||
run: pip install esptool
|
||||
|
||||
|
||||
# - name: Add www folder to release
|
||||
# uses: svenstaro/upload-release-action@v2
|
||||
# with:
|
||||
# repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# file: ESP32_AP-Flasher/data/www/*
|
||||
# tag: ${{ github.ref }}
|
||||
# file_glob: true
|
||||
|
||||
# - name: Add fonts folder to release
|
||||
# uses: svenstaro/upload-release-action@v2
|
||||
# with:
|
||||
# repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# file: ESP32_AP-Flasher/data/fonts/*
|
||||
# tag: ${{ github.ref }}
|
||||
# file_glob: true
|
||||
|
||||
# - name: Add data folder to release
|
||||
# uses: svenstaro/upload-release-action@v2
|
||||
# with:
|
||||
# repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# file: ESP32_AP-Flasher/data/*
|
||||
# tag: ${{ github.ref }}
|
||||
# file_glob: true
|
||||
|
||||
- name: Build firmware for ESP32
|
||||
run: |
|
||||
cd ESP32_AP-Flasher
|
||||
export PLATFORMIO_BUILD_FLAGS="-D BUILD_ESPTYPE=ESP32 -D BUILD_VERSION=${{ github.ref }}"
|
||||
export PLATFORMIO_BUILD_FLAGS="-D BUILD_VERSION=${{ github.ref }} -D SHA=$GITHUB_SHA"
|
||||
pio run --environment Simple_AP
|
||||
mkdir /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32fw
|
||||
cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32fw/boot_app0.bin
|
||||
@@ -52,7 +76,7 @@ jobs:
|
||||
- name: Build firmware for ESP32-S2
|
||||
run: |
|
||||
cd ESP32_AP-Flasher
|
||||
export PLATFORMIO_BUILD_FLAGS="-D BUILD_ESPTYPE=ESP32S2 -D BUILD_VERSION=${{ github.ref }}"
|
||||
export PLATFORMIO_BUILD_FLAGS="-D BUILD_VERSION=${{ github.ref }} -D SHA=$GITHUB_SHA"
|
||||
pio run --environment OpenEPaperLink_Mini_AP
|
||||
mkdir /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32s2fw
|
||||
cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32s2fw/boot_app0.bin
|
||||
@@ -74,7 +98,7 @@ jobs:
|
||||
- name: Build firmware for ESP32-S3
|
||||
run: |
|
||||
cd ESP32_AP-Flasher
|
||||
export PLATFORMIO_BUILD_FLAGS="-D BUILD_ESPTYPE=ESP32S3 -D BUILD_VERSION=${{ github.ref }}"
|
||||
export PLATFORMIO_BUILD_FLAGS="-D BUILD_VERSION=${{ github.ref }} -D SHA=$GITHUB_SHA"
|
||||
pio run --environment OpenEPaperLink_AP_and_Flasher
|
||||
mkdir /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32s3fw
|
||||
cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32s3fw/boot_app0.bin
|
||||
@@ -93,62 +117,44 @@ jobs:
|
||||
cd /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32s3fw
|
||||
esptool.py --chip esp32-s3 merge_bin -o merged-firmware.bin --flash_mode dio --flash_freq 80m --flash_size 16MB 0x0000 bootloader.bin 0x8000 partitions.bin 0xe000 boot_app0.bin 0x10000 firmware.bin 0x00c90000 littlefs.bin
|
||||
|
||||
- name: Add ESP32 binary to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32fw/firmware.bin
|
||||
asset_name: ESP32firmware.bin
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
body: "ESP32 firmware binary"
|
||||
|
||||
- name: Add ESP32-S2 binary to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32s2fw/firmware.bin
|
||||
asset_name: ESP32S2firmware.bin
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
body: "ESP32-S2 firmware binary"
|
||||
|
||||
- name: Add ESP32-S3 binary to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32s3fw/firmware.bin
|
||||
asset_name: ESP32S3firmware.bin
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
body: "ESP32-S3 firmware binary"
|
||||
- name: move binaries
|
||||
run: |
|
||||
mkdir espbinaries
|
||||
cp esp32fw/firmware.bin espbinaries/Simple_AP.bin
|
||||
cp esp32s2fw/firmware.bin espbinaries/OpenEPaperLink_Mini_AP.bin
|
||||
cp esp32s3fw/firmware.bin espbinaries/OpenEPaperLink_AP_and_Flasher.bin
|
||||
cp esp32fw/merged-firmware.bin espbinaries/Simple_AP_full.bin
|
||||
cp esp32s2fw/merged-firmware.bin espbinaries/OpenEPaperLink_Mini_AP_full.bin
|
||||
cp esp32s3fw/merged-firmware.bin espbinaries/OpenEPaperLink_AP_and_Flasher_full.bin
|
||||
|
||||
- name: Add ESP32 full system to release
|
||||
- name: generate releas json file
|
||||
run: |
|
||||
python genfilelist.py -v"${{ github.ref }}" $GITHUB_REPOSITORY $GITHUB_SHA
|
||||
|
||||
- name: Add file list to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32fw/merged-firmware.bin
|
||||
asset_name: ESP32full.bin
|
||||
file: /home/runner/work/OpenEPaperLink/OpenEPaperLink/files.json
|
||||
asset_name: files.json
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
body: "ESP32 full binary"
|
||||
|
||||
- name: Add ESP32-S2 full system to release
|
||||
body: "file list"
|
||||
|
||||
- name: Add esp bins to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32s2fw/merged-firmware.bin
|
||||
asset_name: ESP32S2full.bin
|
||||
file: espbinaries/*
|
||||
tag: ${{ github.ref }}
|
||||
file_glob: true
|
||||
overwrite: true
|
||||
body: "ESP32-S2 full binary"
|
||||
|
||||
- name: Add ESP32-S3 full system to release
|
||||
|
||||
- name: Add tag bins to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32s3fw/merged-firmware.bin
|
||||
asset_name: ESP32S3full.bin
|
||||
file: binaries/*
|
||||
tag: ${{ github.ref }}
|
||||
file_glob: true
|
||||
overwrite: true
|
||||
body: "ESP32-S3 full binary"
|
||||
|
||||
74
genfilelist.py
Normal file
74
genfilelist.py
Normal file
@@ -0,0 +1,74 @@
|
||||
import os
|
||||
import json
|
||||
import hashlib
|
||||
import sys
|
||||
import re
|
||||
from datetime import datetime
|
||||
|
||||
def generate_file_hashes(folder_path,internal_path,tag):
|
||||
file_list = []
|
||||
for file_name in os.listdir(folder_path):
|
||||
file_path = os.path.join(folder_path, file_name)
|
||||
if os.path.isfile(file_path):
|
||||
file_stats = os.stat(file_path)
|
||||
md5_hash = calculate_md5(file_path)
|
||||
file_info = {
|
||||
"name": file_name,
|
||||
"path": internal_path + file_name,
|
||||
"size": file_stats.st_size,
|
||||
"md5": md5_hash,
|
||||
"url": "https://raw.githubusercontent.com/"+sys.argv[2]+"/"+sys.argv[3]+"/ESP32_AP-Flasher/data" + internal_path + file_name
|
||||
}
|
||||
file_list.append(file_info)
|
||||
return file_list
|
||||
|
||||
def generate_file_hashes2(folder_path,tag):
|
||||
file_list = []
|
||||
for file_name in os.listdir(folder_path):
|
||||
file_path = os.path.join(folder_path, file_name)
|
||||
if os.path.isfile(file_path):
|
||||
file_stats = os.stat(file_path)
|
||||
md5_hash = calculate_md5(file_path)
|
||||
file_info = {
|
||||
"name": file_name,
|
||||
"size": file_stats.st_size,
|
||||
"md5": md5_hash,
|
||||
"url": "https://github.com/"+sys.argv[2]+"/releases/download/"+tag+"/"+file_name
|
||||
}
|
||||
file_list.append(file_info)
|
||||
return file_list
|
||||
|
||||
def calculate_md5(file_path):
|
||||
hash_md5 = hashlib.md5()
|
||||
with open(file_path, "rb") as file:
|
||||
for chunk in iter(lambda: file.read(4096), b""):
|
||||
hash_md5.update(chunk)
|
||||
return hash_md5.hexdigest()
|
||||
|
||||
rp = os.getcwd()
|
||||
|
||||
now = datetime.now()
|
||||
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
|
||||
tag = sys.argv[1]
|
||||
match = re.search(r'\d+\.\d+', tag)
|
||||
tag = match.group()
|
||||
|
||||
binaries = generate_file_hashes2(rp + "/espbinaries",tag)
|
||||
tagota = generate_file_hashes2(rp + "/binaries",tag)
|
||||
files1 = generate_file_hashes(rp + "/ESP32_AP-Flasher/data/www","/www/",tag)
|
||||
files1.extend(generate_file_hashes(rp + "/ESP32_AP-Flasher/data","/",tag))
|
||||
files1.extend(generate_file_hashes(rp + "/ESP32_AP-Flasher/data/fonts","/fonts/",tag))
|
||||
|
||||
jsonarray = {
|
||||
"releaseid": tag,
|
||||
"sha": sys.argv[3],
|
||||
"repo": sys.argv[2],
|
||||
"builddate": dt_string,
|
||||
"binaries": binaries,
|
||||
"files": files1,
|
||||
"tagota": tagota,
|
||||
}
|
||||
|
||||
json_file_path = "files.json"
|
||||
with open(json_file_path, "w") as json_file:
|
||||
json.dump(jsonarray, json_file, indent=4)
|
||||
Reference in New Issue
Block a user