OTA manifest (#426)
This commit is contained in:
3
.github/workflows/beta.yml
vendored
3
.github/workflows/beta.yml
vendored
@@ -108,11 +108,12 @@ jobs:
|
|||||||
mkdir -p ota/beta/
|
mkdir -p ota/beta/
|
||||||
cp -vf release/*/nuki_hub_*.bin ota/beta/
|
cp -vf release/*/nuki_hub_*.bin ota/beta/
|
||||||
rm -rf release
|
rm -rf release
|
||||||
|
python3 resources/ota_manifest.py beta $Version
|
||||||
- name: Commit binaries to master
|
- name: Commit binaries to master
|
||||||
uses: stefanzweifel/git-auto-commit-action@v5
|
uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
with:
|
with:
|
||||||
commit_message: "Update beta binaries"
|
commit_message: "Update beta binaries"
|
||||||
file_pattern: 'ota/beta/*.bin'
|
file_pattern: 'ota/beta/*.bin ota/manifest.json'
|
||||||
branch: master
|
branch: master
|
||||||
skip_dirty_check: true
|
skip_dirty_check: true
|
||||||
skip_fetch: true
|
skip_fetch: true
|
||||||
|
|||||||
7
.github/workflows/build.yml
vendored
7
.github/workflows/build.yml
vendored
@@ -166,6 +166,9 @@ jobs:
|
|||||||
name: "Nuki Hub ${{ steps.get_version.outputs.VERSION }}"
|
name: "Nuki Hub ${{ steps.get_version.outputs.VERSION }}"
|
||||||
artifacts: ${{ steps.zip.outputs.artifacts }}
|
artifacts: ${{ steps.zip.outputs.artifacts }}
|
||||||
artifactContentType: application/zip
|
artifactContentType: application/zip
|
||||||
|
- name: Add version info
|
||||||
|
env:
|
||||||
|
Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
|
||||||
- name: Copy binaries to ota and webflash and remove beta
|
- name: Copy binaries to ota and webflash and remove beta
|
||||||
run: |
|
run: |
|
||||||
cp -vf release/*/nuki_hub_*.bin ota/
|
cp -vf release/*/nuki_hub_*.bin ota/
|
||||||
@@ -174,11 +177,13 @@ jobs:
|
|||||||
rm -rf debug
|
rm -rf debug
|
||||||
rm -rf NukiHub-*.zip
|
rm -rf NukiHub-*.zip
|
||||||
git rm -r --cached ota/beta/*.bin
|
git rm -r --cached ota/beta/*.bin
|
||||||
|
python3 resources/ota_manifest.py release $Version
|
||||||
|
python3 resources/ota_manifest.py beta none
|
||||||
- name: Commit binaries to master
|
- name: Commit binaries to master
|
||||||
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 for version ${{ steps.get_version.outputs.VERSION }}"
|
||||||
file_pattern: 'ota/*.bin ota/beta/*.bin ota/beta/debug/*.bin webflash/*.bin'
|
file_pattern: 'ota/*.bin ota/manifest.json ota/beta/*.bin webflash/*.bin'
|
||||||
branch: master
|
branch: master
|
||||||
skip_dirty_check: true
|
skip_dirty_check: true
|
||||||
skip_fetch: true
|
skip_fetch: true
|
||||||
|
|||||||
3
.github/workflows/nightly.yml
vendored
3
.github/workflows/nightly.yml
vendored
@@ -115,11 +115,12 @@ jobs:
|
|||||||
mkdir -p ota/master/
|
mkdir -p ota/master/
|
||||||
cp -vf release/*/nuki_hub_*.bin ota/master/
|
cp -vf release/*/nuki_hub_*.bin ota/master/
|
||||||
rm -rf release
|
rm -rf release
|
||||||
|
python3 resources/ota_manifest.py master $Version
|
||||||
- name: Commit binaries to master
|
- name: Commit binaries to master
|
||||||
uses: stefanzweifel/git-auto-commit-action@v5
|
uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
with:
|
with:
|
||||||
commit_message: "Update master binaries"
|
commit_message: "Update master binaries"
|
||||||
file_pattern: 'ota/master/*.bin'
|
file_pattern: 'ota/master/*.bin ota/manifest.json'
|
||||||
branch: master
|
branch: master
|
||||||
skip_dirty_check: true
|
skip_dirty_check: true
|
||||||
skip_fetch: true
|
skip_fetch: true
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -6,7 +6,7 @@ cmake-build-debug
|
|||||||
cmake-build-release
|
cmake-build-release
|
||||||
cmake-build-release-s3
|
cmake-build-release-s3
|
||||||
bin/*
|
bin/*
|
||||||
ota/*
|
ota/*.bin
|
||||||
webflash/*.bin
|
webflash/*.bin
|
||||||
.pio
|
.pio
|
||||||
.vscode
|
.vscode
|
||||||
|
|||||||
17
ota/manifest.json
Normal file
17
ota/manifest.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"release": {
|
||||||
|
"time": "2024-07-18 00:00:00",
|
||||||
|
"version": "8.35",
|
||||||
|
"build": ""
|
||||||
|
},
|
||||||
|
"beta": {
|
||||||
|
"time": "2024-07-18 00:00:00",
|
||||||
|
"version": "9.00",
|
||||||
|
"build": ""
|
||||||
|
},
|
||||||
|
"master": {
|
||||||
|
"time": "2024-07-18 00:00:00",
|
||||||
|
"version": "9.00",
|
||||||
|
"build": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
34
resources/ota_manifest.py
Normal file
34
resources/ota_manifest.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import re, json, argparse
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
|
parser.add_argument('ota_type', type=str)
|
||||||
|
parser.add_argument('build', type=str)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
with open('ota/manifest.json', 'r+') as json_file:
|
||||||
|
data = json.load(json_file)
|
||||||
|
if (args.build == 'none'):
|
||||||
|
data[args.ota_type]['time'] = "0000-00-00 00:00:00"
|
||||||
|
data[args.ota_type]['version'] = "No beta available"
|
||||||
|
data[args.ota_type]['build'] = ""
|
||||||
|
else:
|
||||||
|
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]['build'] = args.build
|
||||||
|
json_file.seek(0)
|
||||||
|
json.dump(data, json_file, indent=4)
|
||||||
|
json_file.truncate()
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#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"
|
||||||
|
|
||||||
#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://github.com/technyon/nuki_hub/raw/master/ota/nuki_hub_esp32c3.bin"
|
||||||
|
|||||||
Reference in New Issue
Block a user