Compare commits

..

7 Commits

Author SHA1 Message Date
Hermes
df8b29d78a fix: publish raw OTA files to rolling release with backup artifacts
All checks were successful
OTA build / build-ota (push) Successful in 3m20s
2026-08-30 18:17:53 -05:00
Hermes
10cb1f3206 fix: use upload-artifact v3 for Gitea compatibility
All checks were successful
OTA build / build-ota (push) Successful in 3m2s
2026-08-30 14:44:19 -05:00
Hermes
ac0b986fde fix: switch OTA delivery to direct attached artifacts
Some checks failed
OTA build / build-ota (push) Failing after 2m59s
2026-08-30 12:08:27 -05:00
Hermes
eb14de7423 ci: trigger actor-namespace workflow after registration
Some checks failed
OTA build / build-ota (push) Has been cancelled
2026-08-30 10:52:03 -05:00
Hermes
f86d264f19 ci: trigger actor-namespace ota upload
Some checks failed
OTA build / build-ota (push) Has been cancelled
2026-08-30 10:35:32 -05:00
Hermes
872227c08b fix: publish OTA packages under actor namespace 2026-08-30 10:35:32 -05:00
Hermes
676edff2c0 fix: make OTA workflow YAML valid and remove debug files
Some checks failed
OTA build / build-ota (push) Has been cancelled
2026-08-30 10:27:30 -05:00
3 changed files with 94 additions and 38 deletions

View File

@@ -1,9 +1,5 @@
name: OTA build name: OTA build
permissions:
contents: read
packages: write
on: on:
push: push:
branches: branches:
@@ -13,7 +9,7 @@ on:
jobs: jobs:
build-ota: build-ota:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 45 timeout-minutes: 60
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -21,59 +17,119 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: '3.11' python-version: "3.11"
- name: Install PlatformIO - name: Install PlatformIO
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install platformio pip install platformio
- name: Build filesystem-aware OTA package - name: Build OTA package
run: python scripts/build_ota_package.py run: python scripts/build_ota_package.py
- name: Prepare direct OTA files - name: Prepare direct OTA files
run: | run: |
set -eu set -eu
rm -rf dist/ota
mkdir -p dist/ota mkdir -p dist/ota
count=0 found=0
for file in dist/*.tslpkg; do for pkg in dist/*.tslpkg; do
[ -f "$file" ] || continue [ -f "$pkg" ] || continue
cp "$file" dist/ota/ cp "$pkg" dist/ota/
count=$((count+1)) found=1
done done
if [ "$count" -eq 0 ]; then if [ "$found" -eq 0 ]; then
echo 'No .tslpkg OTA package was produced.' >&2 echo 'No .tslpkg OTA package was produced.' >&2
exit 1 exit 1
fi fi
find dist/ota -maxdepth 1 -type f | sort find dist/ota -maxdepth 1 -type f | sort
- name: Upload direct OTA files to Gitea Packages - name: Upload backup OTA artifact ZIP
env: uses: actions/upload-artifact@v3
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} with:
run: | name: ota-files
set -eu path: dist/ota/*
package_name="$(printf '%s' "${GITHUB_REPOSITORY#*/}" | tr '[:upper:]' '[:lower:]')-ota" if-no-files-found: error
package_version="${GITHUB_SHA}"
base_url="${GITHUB_SERVER_URL}/api/packages/${GITHUB_REPOSITORY_OWNER}/generic/${package_name}/${package_version}"
for file in dist/ota/*; do
[ -f "$file" ] || continue
curl --fail --silent --show-error --user "${GITHUB_ACTOR}:${GITEA_TOKEN}" --upload-file "$file" "${base_url}/$(basename "$file")"
echo "Uploaded $(basename "$file")"
done
- name: Verify uploaded OTA files - name: Publish raw OTA files to rolling release
env: env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: | run: |
set -eu python - <<'PY'
package_name="$(printf '%s' "${GITHUB_REPOSITORY#*/}" | tr '[:upper:]' '[:lower:]')-ota"
package_version="${GITHUB_SHA}"
curl --fail --silent --show-error --user "${GITHUB_ACTOR}:${GITEA_TOKEN}" "${GITHUB_SERVER_URL}/api/v1/packages/${GITHUB_REPOSITORY_OWNER}/generic/${package_name}/${package_version}/files" > /tmp/package-files.json
python3 - <<'PY'
import json import json
import mimetypes
import os
import sys
from pathlib import Path from pathlib import Path
files = json.loads(Path('/tmp/package-files.json').read_text()) from urllib.request import Request, urlopen
assert files, 'no package files returned' from urllib.error import HTTPError
for item in files:
print(item.get('name') or item.get('file_name') or item) server = os.environ['GITHUB_SERVER_URL']
repo = os.environ['GITHUB_REPOSITORY']
token = os.environ.get('GITEA_TOKEN')
if not token:
print('GITEA_TOKEN missing', file=sys.stderr)
sys.exit(1)
api = f"{server}/api/v1/repos/{repo}"
headers = {
'Authorization': f'token {token}',
'Accept': 'application/json',
'Content-Type': 'application/json',
'User-Agent': 'Hermes-Agent'
}
tag = 'ota-builds'
release_name = 'OTA Builds'
body = 'Rolling OTA files from the latest successful push build.'
def req(url, method='GET', data=None, extra_headers=None):
h = dict(headers)
if extra_headers:
h.update(extra_headers)
payload = None if data is None else json.dumps(data).encode()
r = Request(url, data=payload, headers=h, method=method)
with urlopen(r, timeout=120) as resp:
body = resp.read()
if not body:
return None
text = body.decode()
try:
return json.loads(text)
except json.JSONDecodeError:
return text
try:
release = req(f"{api}/releases/tags/{tag}")
except HTTPError as e:
if e.code != 404:
raise
release = req(f"{api}/releases", method='POST', data={
'tag_name': tag,
'target': os.environ.get('GITHUB_SHA', ''),
'name': release_name,
'body': body,
'draft': False,
'prerelease': True,
})
release_id = release['id']
existing = req(f"{api}/releases/{release_id}/assets") or []
for asset in existing:
rid = asset['id']
req(f"{api}/releases/{release_id}/assets/{rid}", method='DELETE')
for path in sorted(Path('dist/ota').glob('*')):
if not path.is_file():
continue
mime = mimetypes.guess_type(path.name)[0] or 'application/octet-stream'
upload_headers = {
'Authorization': f'token {token}',
'Content-Type': mime,
'Accept': 'application/json',
'User-Agent': 'Hermes-Agent'
}
url = f"{api}/releases/{release_id}/assets?name={path.name}"
data = path.read_bytes()
r = Request(url, data=data, headers=upload_headers, method='POST')
with urlopen(r, timeout=240) as resp:
print(resp.read().decode())
PY PY

View File

@@ -1 +0,0 @@
2026-08-30T02:53:27Z trigger push-based OTA verification

View File

@@ -1 +1,2 @@
yaml-fix trigger 2026-08-30T10:17:26-05:00 actor namespace repro 2026-08-30T10:35:32-05:00
post-registration trigger 2026-08-30T10:52:02-05:00