Add binaries to binary branch instead of master (#441)

This commit is contained in:
iranl
2024-08-01 13:44:23 +02:00
committed by GitHub
parent cccca46601
commit f57a9625b7
12 changed files with 213 additions and 66 deletions

View File

@@ -49,6 +49,7 @@ jobs:
Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }} Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
run: | run: |
sed -i "s/unknownbuildnr/$Version/g" src/Config.h sed -i "s/unknownbuildnr/$Version/g" src/Config.h
python3 resources/config_version.py beta
- name: Build ${{ matrix.build }} PlatformIO Project ${{ matrix.board }} - name: Build ${{ matrix.build }} PlatformIO Project ${{ matrix.board }}
run: | run: |
if [ "$BUILD" = "debug" ]; then if [ "$BUILD" = "debug" ]; then
@@ -97,7 +98,21 @@ jobs:
- name: Git Checkout - name: Git Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
ref: ${{ github.head_ref }} ref: binary
- name: Git Checkout master
uses: actions/checkout@v4
with:
ref: master
path: master
sparse-checkout: |
resources/ota_manifest.py
src/Config.h
- name: Git Commands
run: |
git checkout --orphan newBinary
git branch -D binary
git branch -M binary
git rm --cached --ignore-unmatch -r *
- name: Download release assets - name: Download release assets
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
@@ -108,17 +123,23 @@ jobs:
Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }} Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
run: | run: |
mkdir -p ota/beta/ mkdir -p ota/beta/
mkdir -p resources/
mkdir -p src/
cp -vf release/*/nuki_hub_*.bin ota/beta/ cp -vf release/*/nuki_hub_*.bin ota/beta/
rm -rf release cp -vf master/resources/ota_manifest.py resources/ota_manifest.py
cp -vf master/src/Config.h src/Config.h
python3 resources/ota_manifest.py beta $Version python3 resources/ota_manifest.py beta $Version
- name: Commit binaries to master find * -not -path "ota*" -not -path "webflash*" -delete
rm -rf .github .gitignore .gitmodules
- name: Commit binaries to binary
uses: stefanzweifel/git-auto-commit-action@v5 uses: stefanzweifel/git-auto-commit-action@v5
with: with:
commit_message: "Update beta binaries" commit_message: "Update binaries"
file_pattern: 'ota/beta/*.bin ota/manifest.json' file_pattern: 'ota/* ota/master/* ota/beta/* webflash/*'
branch: master branch: binary
skip_dirty_check: true skip_dirty_check: true
skip_fetch: true skip_fetch: true
skip_checkout: true skip_checkout: true
disable_globbing: true disable_globbing: true
add_options: '-f' add_options: '-f'
push_options: '-f'

View File

@@ -19,12 +19,11 @@ jobs:
submodules: recursive submodules: recursive
- name: Get new commits - name: Get new commits
run: echo "NEW_COMMIT_COUNT=$(git log --oneline --since '24 hours ago' | wc -l)" >> $GITHUB_ENV run: echo "NEW_COMMIT_COUNT=$(git log --oneline --since '24 hours ago' | wc -l)" >> $GITHUB_ENV
- name: Check if commits larger than 1 - name: Check if commits larger than 0
if: ${{ env.NEW_COMMIT_COUNT < 2 }} if: ${{ env.NEW_COMMIT_COUNT < 1 }}
run: exit 1 run: exit 1
build: build:
name: Build ${{ matrix.board }} (${{ matrix.build }}) name: Build ${{ matrix.board }} (${{ matrix.build }})
if: github.repository == 'technyon/nuki_hub'
needs: check-commits needs: check-commits
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
@@ -67,6 +66,7 @@ jobs:
Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }} Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
run: | run: |
sed -i "s/unknownbuildnr/$Version/g" src/Config.h sed -i "s/unknownbuildnr/$Version/g" src/Config.h
python3 resources/config_version.py master
- name: Build ${{ matrix.build }} PlatformIO Project ${{ matrix.board }} - name: Build ${{ matrix.build }} PlatformIO Project ${{ matrix.board }}
run: | run: |
if [ "$BUILD" = "debug" ]; then if [ "$BUILD" = "debug" ]; then
@@ -109,14 +109,27 @@ jobs:
path: ${{ matrix.build }}/${{ env.VARIANT }} path: ${{ matrix.build }}/${{ env.VARIANT }}
ota-nightly: ota-nightly:
name: Create nightly from latest master name: Create nightly from latest master
if: github.repository == 'technyon/nuki_hub'
needs: build needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Git Checkout - name: Git Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
ref: ${{ github.head_ref }} ref: binary
- name: Git Checkout master
uses: actions/checkout@v4
with:
ref: master
path: master
sparse-checkout: |
resources/ota_manifest.py
src/Config.h
- name: Git Commands
run: |
git checkout --orphan newBinary
git branch -D binary
git branch -M binary
git rm --cached --ignore-unmatch -r *
- name: Download release assets - name: Download release assets
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
@@ -127,17 +140,23 @@ jobs:
Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }} Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
run: | run: |
mkdir -p ota/master/ mkdir -p ota/master/
mkdir -p resources/
mkdir -p src/
cp -vf release/*/nuki_hub_*.bin ota/master/ cp -vf release/*/nuki_hub_*.bin ota/master/
rm -rf release cp -vf master/resources/ota_manifest.py resources/ota_manifest.py
cp -vf master/src/Config.h src/Config.h
python3 resources/ota_manifest.py master $Version python3 resources/ota_manifest.py master $Version
- name: Commit binaries to master find * -not -path "ota*" -not -path "webflash*" -delete
rm -rf .github .gitignore .gitmodules
- name: Commit binaries to binary
uses: stefanzweifel/git-auto-commit-action@v5 uses: stefanzweifel/git-auto-commit-action@v5
with: with:
commit_message: "Update master binaries" commit_message: "Update binaries"
file_pattern: 'ota/master/*.bin ota/manifest.json' file_pattern: 'ota/* ota/master/* ota/beta/* webflash/*'
branch: master branch: binary
skip_dirty_check: true skip_dirty_check: true
skip_fetch: true skip_fetch: true
skip_checkout: true skip_checkout: true
disable_globbing: true disable_globbing: true
add_options: '-f' add_options: '-f'
push_options: '-f'

View File

@@ -97,10 +97,24 @@ jobs:
- name: Git Checkout - name: Git Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
ref: ${{ github.head_ref }} ref: binary
- name: Git Checkout master
uses: actions/checkout@v4
with:
ref: master
path: master
sparse-checkout: |
resources/ota_manifest.py
src/Config.h
- name: Git Commands
run: |
git checkout --orphan newBinary
git branch -D binary
git branch -M binary
git rm --cached --ignore-unmatch -r *
- name: Get the version - name: Get the version
id: get_version id: get_version
run: echo "VERSION=$(cat src/Config.h | grep -oP '(?<=#define NUKI_HUB_VERSION \")(.*)(?=\")')" >> $GITHUB_OUTPUT run: echo "VERSION=$(cat master/src/Config.h | grep -oP '(?<=#define NUKI_HUB_VERSION \")(.*)(?=\")')" >> $GITHUB_OUTPUT
- name: Download release assets - name: Download release assets
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
@@ -167,22 +181,27 @@ jobs:
env: env:
Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }} Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
run: | run: |
mkdir -p ota/
mkdir -p resources/
mkdir -p src/
cp -vf release/*/nuki_hub_*.bin ota/ cp -vf release/*/nuki_hub_*.bin ota/
cp -vf release/*/webflash_nuki_hub_*.bin webflash/ cp -vf release/*/webflash_nuki_hub_*.bin webflash/
rm -rf release cp -vf master/resources/ota_manifest.py resources/ota_manifest.py
rm -rf debug cp -vf master/src/Config.h src/Config.h
rm -rf NukiHub-*.zip
git rm -r --cached ota/beta/*.bin
python3 resources/ota_manifest.py release $Version python3 resources/ota_manifest.py release $Version
python3 resources/ota_manifest.py beta none python3 resources/ota_manifest.py beta none
- name: Commit binaries to master find * -not -path "ota*" -not -path "webflash*" -delete
rm -rf ota/beta/*.bin
rm -rf .github .gitignore .gitmodules
- name: Commit binaries to binary
uses: stefanzweifel/git-auto-commit-action@v5 uses: stefanzweifel/git-auto-commit-action@v5
with: with:
commit_message: "Update binaries for version ${{ steps.get_version.outputs.VERSION }}" commit_message: "Update binaries"
file_pattern: 'ota/*.bin ota/manifest.json ota/beta/*.bin webflash/*.bin' file_pattern: 'ota/* ota/master/* webflash/*'
branch: master branch: binary
skip_dirty_check: true skip_dirty_check: true
skip_fetch: true skip_fetch: true
skip_checkout: true skip_checkout: true
disable_globbing: true disable_globbing: true
add_options: '-f' add_options: '-f'
push_options: '-f'

View File

@@ -13,7 +13,7 @@
type="module" type="module"
src="https://unpkg.com/esp-web-tools@8.0.1/dist/web/install-button.js?module"> src="https://unpkg.com/esp-web-tools@8.0.1/dist/web/install-button.js?module">
</script> </script>
<esp-web-install-button id="installButton" manifest="webflash/manifest.json"></esp-web-install-button> <esp-web-install-button id="installButton" manifest="https://raw.githubusercontent.com/technyon/nuki_hub/binary/webflash/manifest.json"></esp-web-install-button>
<br><br><br><br> <br><br><br><br>
Note: If flashing doesn't work, press and hold the "BOOT" switch, then click "Install". Note: If flashing doesn't work, press and hold the "BOOT" switch, then click "Install".
</div> </div>

12
pio_package_pre.py Normal file
View File

@@ -0,0 +1,12 @@
import re, shutil, os
from datetime import datetime, timezone
regex = r"\#define NUKI_HUB_DATE \"(.*)\""
content_new = ""
with open ('src/Config.h', 'r' ) as readfile:
file_content = readfile.read()
content_new = re.sub(regex, "#define NUKI_HUB_DATE \"" + datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S") + "\"", file_content, flags = re.M)
with open('src/Config.h', 'w') as writefile:
writefile.write(content_new)

View File

@@ -59,7 +59,9 @@ monitor_filters =
[env:esp32dev] [env:esp32dev]
board = esp32dev board = esp32dev
extra_scripts = post:pio_package.py extra_scripts =
pre:pio_package_pre.py
post:pio_package.py
build_flags = build_flags =
${env.build_flags} ${env.build_flags}
-DBLESCANNER_USE_LATEST_NIMBLE -DBLESCANNER_USE_LATEST_NIMBLE
@@ -87,7 +89,9 @@ board = esp32-c6-devkitm-1
platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.03/platform-espressif32-2023.10.03.zip platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.03/platform-espressif32-2023.10.03.zip
framework = arduino framework = arduino
board = esp32-solo1 board = esp32-solo1
extra_scripts = post:pio_package.py extra_scripts =
pre:pio_package_pre.py
post:pio_package.py
build_flags = build_flags =
${env.build_flags} ${env.build_flags}
-DFRAMEWORK_ARDUINO_SOLO1 -DFRAMEWORK_ARDUINO_SOLO1

View File

@@ -0,0 +1,40 @@
import re, json, argparse
from urllib.request import urlopen
parser = argparse.ArgumentParser()
parser.add_argument('ota_type', type=str)
args = parser.parse_args()
regex = r"\#define NUKI_HUB_VERSION \"(.*)\""
version = "unknown"
with open('src/Config.h', 'r') as file:
file_content = file.read()
matches = re.finditer(regex, file_content, re.MULTILINE)
for matchNum, match in enumerate(matches, start=1):
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
version = match.group(groupNum)
data = ""
number = 1
response = urlopen("https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/manifest.json")
data = json.loads(response.read().decode("utf-8"))
if ("number" not in data[args.ota_type]):
number = 1
elif (data[args.ota_type]['version'] == version):
number = data[args.ota_type]['number'] + 1
else:
number = 1
content_new = ""
with open ('src/Config.h', 'r' ) as readfile:
file_content = readfile.read()
content_new = re.sub(regex, "#define NUKI_HUB_VERSION \"" + str(version) + "-" + args.ota_type + str(number) + "\"", file_content, flags = re.M)
with open('src/Config.h', 'w') as writefile:
writefile.write(content_new)

View File

@@ -25,7 +25,15 @@ with open('ota/manifest.json', 'r+') as json_file:
data[args.ota_type]['time'] = "0000-00-00 00:00:00" data[args.ota_type]['time'] = "0000-00-00 00:00:00"
data[args.ota_type]['version'] = "No beta available" data[args.ota_type]['version'] = "No beta available"
data[args.ota_type]['build'] = "" data[args.ota_type]['build'] = ""
del(data[args.ota_type]['number'])
else: else:
if ("number" not in data[args.ota_type]):
data[args.ota_type]['number'] = 1
elif (data[args.ota_type]['version'] == version):
data[args.ota_type]['number'] = data[args.ota_type]['number'] + 1
else:
data[args.ota_type]['number'] = 1
data[args.ota_type]['time'] = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S") data[args.ota_type]['time'] = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S")
data[args.ota_type]['version'] = version data[args.ota_type]['version'] = version
data[args.ota_type]['build'] = args.build data[args.ota_type]['build'] = args.build

View File

@@ -4,47 +4,48 @@
#define NUKI_HUB_VERSION "9.00" #define NUKI_HUB_VERSION "9.00"
#define NUKI_HUB_BUILD "unknownbuildnr" #define NUKI_HUB_BUILD "unknownbuildnr"
#define NUKI_HUB_DATE "unknownbuilddate"
#define GITHUB_LATEST_RELEASE_URL (char*)"https://github.com/technyon/nuki_hub/releases/latest" #define GITHUB_LATEST_RELEASE_URL (char*)"https://github.com/technyon/nuki_hub/releases/latest"
#define GITHUB_LATEST_RELEASE_API_URL (char*)"https://api.github.com/repos/technyon/nuki_hub/releases/latest" #define GITHUB_LATEST_RELEASE_API_URL (char*)"https://api.github.com/repos/technyon/nuki_hub/releases/latest"
#define GITHUB_OTA_MANIFEST_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/manifest.json" #define GITHUB_OTA_MANIFEST_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/manifest.json"
#if defined(CONFIG_IDF_TARGET_ESP32C3) #if defined(CONFIG_IDF_TARGET_ESP32C3)
#define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/nuki_hub_esp32c3.bin" #define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32c3.bin"
#define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/nuki_hub_updater_esp32c3.bin" #define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32c3.bin"
#define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/beta/nuki_hub_esp32c3.bin" #define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_esp32c3.bin"
#define GITHUB_BETA_UPDATER_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/beta/nuki_hub_updater_esp32c3.bin" #define GITHUB_BETA_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_updater_esp32c3.bin"
#define GITHUB_MASTER_RELEASE_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/master/nuki_hub_esp32c3.bin" #define GITHUB_MASTER_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_esp32c3.bin"
#define GITHUB_MASTER_UPDATER_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/master/nuki_hub_updater_esp32c3.bin" #define GITHUB_MASTER_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_updater_esp32c3.bin"
#elif defined(CONFIG_IDF_TARGET_ESP32S3) #elif defined(CONFIG_IDF_TARGET_ESP32S3)
#define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/nuki_hub_esp32s3.bin" #define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32s3.bin"
#define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/nuki_hub_updater_esp32s3.bin" #define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32s3.bin"
#define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/beta/nuki_hub_esp32s3.bin" #define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_esp32s3.bin"
#define GITHUB_BETA_UPDATER_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/beta/nuki_hub_updater_esp32s3.bin" #define GITHUB_BETA_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_updater_esp32s3.bin"
#define GITHUB_MASTER_RELEASE_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/master/nuki_hub_esp32s3.bin" #define GITHUB_MASTER_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_esp32s3.bin"
#define GITHUB_MASTER_UPDATER_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/master/nuki_hub_updater_esp32s3.bin" #define GITHUB_MASTER_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_updater_esp32s3.bin"
#elif defined(CONFIG_IDF_TARGET_ESP32C6) #elif defined(CONFIG_IDF_TARGET_ESP32C6)
#define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/nuki_hub_esp32c6.bin" #define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32c6.bin"
#define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/nuki_hub_updater_esp32c6.bin" #define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32c6.bin"
#define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/beta/nuki_hub_esp32c6.bin" #define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_esp32c6.bin"
#define GITHUB_BETA_UPDATER_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/beta/nuki_hub_updater_esp32c6.bin" #define GITHUB_BETA_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_updater_esp32c6.bin"
#define GITHUB_MASTER_RELEASE_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/master/nuki_hub_esp32c6.bin" #define GITHUB_MASTER_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_esp32c6.bin"
#define GITHUB_MASTER_UPDATER_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/master/nuki_hub_updater_esp32c6.bin" #define GITHUB_MASTER_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_updater_esp32c6.bin"
#else #else
#if defined(FRAMEWORK_ARDUINO_SOLO1) #if defined(FRAMEWORK_ARDUINO_SOLO1)
#define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/nuki_hub_esp32solo1.bin" #define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32solo1.bin"
#define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/nuki_hub_updater_esp32solo1.bin" #define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32solo1.bin"
#define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/beta/nuki_hub_esp32solo1.bin" #define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_esp32solo1.bin"
#define GITHUB_BETA_UPDATER_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/beta/nuki_hub_updater_esp32solo1.bin" #define GITHUB_BETA_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_updater_esp32solo1.bin"
#define GITHUB_MASTER_RELEASE_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/master/nuki_hub_esp32solo1.bin" #define GITHUB_MASTER_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_esp32solo1.bin"
#define GITHUB_MASTER_UPDATER_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/master/nuki_hub_updater_esp32solo1.bin" #define GITHUB_MASTER_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_updater_esp32solo1.bin"
#else #else
#define GITHUB_LATEST_RELEASE_BINARY_URL "https://github.com/technyon/nuki_hub/raw/master/ota/nuki_hub_esp32.bin" #define GITHUB_LATEST_RELEASE_BINARY_URL "https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32.bin"
#define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/nuki_hub_updater_esp32.bin" #define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32.bin"
#define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/beta/nuki_hub_esp32.bin" #define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_esp32.bin"
#define GITHUB_BETA_UPDATER_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/beta/nuki_hub_updater_esp32.bin" #define GITHUB_BETA_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_updater_esp32.bin"
#define GITHUB_MASTER_RELEASE_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/master/nuki_hub_esp32.bin" #define GITHUB_MASTER_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_esp32.bin"
#define GITHUB_MASTER_UPDATER_BINARY_URL (char*)"https://github.com/technyon/nuki_hub/raw/master/ota/master/nuki_hub_updater_esp32.bin" #define GITHUB_MASTER_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_updater_esp32.bin"
#endif #endif
#endif #endif

View File

@@ -426,7 +426,9 @@ void WebCfgServer::buildOtaHtml(String &response, bool errored)
response.concat(NUKI_HUB_VERSION); response.concat(NUKI_HUB_VERSION);
response.concat(" ("); response.concat(" (");
response.concat(NUKI_HUB_BUILD); response.concat(NUKI_HUB_BUILD);
response.concat(")<br>"); response.concat("), ");
response.concat(NUKI_HUB_DATE);
response.concat("<br>");
#ifndef NUKI_HUB_UPDATER #ifndef NUKI_HUB_UPDATER
HTTPClient https; HTTPClient https;

View File

@@ -1,3 +1,14 @@
import shutil import re, shutil, os
from datetime import datetime, timezone
regex = r"\#define NUKI_HUB_DATE \"(.*)\""
content_new = ""
with open ('../src/Config.h', 'r' ) as readfile:
file_content = readfile.read()
content_new = re.sub(regex, "#define NUKI_HUB_DATE \"" + datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S") + "\"", file_content, flags = re.M)
with open('../src/Config.h', 'w') as writefile:
writefile.write(content_new)
shutil.copy("../src/main.cpp", "src/main.cpp") shutil.copy("../src/main.cpp", "src/main.cpp")

View File

@@ -1,5 +1,5 @@
import shutil import re, shutil, os
import os from datetime import datetime, timezone
if not os.path.exists('src/networkDevices/'): if not os.path.exists('src/networkDevices/'):
os.mkdir('src/networkDevices') os.mkdir('src/networkDevices')
@@ -29,4 +29,14 @@ shutil.copy("../src/networkDevices/EthLan8720Device.cpp", "src/networkDevices/Et
shutil.copy("../src/networkDevices/IPConfiguration.cpp", "src/networkDevices/IPConfiguration.cpp") shutil.copy("../src/networkDevices/IPConfiguration.cpp", "src/networkDevices/IPConfiguration.cpp")
shutil.copy("../src/networkDevices/NetworkDevice.cpp", "src/networkDevices/NetworkDevice.cpp") shutil.copy("../src/networkDevices/NetworkDevice.cpp", "src/networkDevices/NetworkDevice.cpp")
shutil.copy("../src/networkDevices/W5500Device.cpp", "src/networkDevices/W5500Device.cpp") shutil.copy("../src/networkDevices/W5500Device.cpp", "src/networkDevices/W5500Device.cpp")
shutil.copy("../src/networkDevices/WifiDevice.cpp", "src/networkDevices/WifiDevice.cpp") shutil.copy("../src/networkDevices/WifiDevice.cpp", "src/networkDevices/WifiDevice.cpp")
regex = r"\#define NUKI_HUB_DATE \"(.*)\""
content_new = ""
with open ('src/Config.h', 'r' ) as readfile:
file_content = readfile.read()
content_new = re.sub(regex, "#define NUKI_HUB_DATE \"" + datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S") + "\"", file_content, flags = re.M)
with open('src/Config.h', 'w') as writefile:
writefile.write(content_new)