Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,9 @@ body:
Please follow the guidelines below to ensure the logs are comprehensive:
- **Boot Issues**: If the problem occurs during boot, capture the logs from the start of your device to a minute or two after the boot completes.
Look for errors or unusual messages during this period.
- **TFT File Update Issues**: For problems related to TFT file updates, include logs from the moment you press the **Update TFT Display** button until a few seconds after the device restarts.
Pay attention to any error messages or warnings during the update process.
- **Other Issues**: For other types of problems, include logs that encompass the issue's onset and continue for a short duration thereafter. This will help in pinpointing the exact moment and nature of the issue.
Expand Down
108 changes: 108 additions & 0 deletions .github/scripts/update_bug_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/usr/bin/env python3
# .github/scripts/update_bug_template.py
#
# Updates version placeholder values in the GitHub bug report template
# (.github/ISSUE_TEMPLATE/bug.yml) without reformatting the file.
#
# Called by the versioning workflow on every release to keep the placeholder
# hints in sync with the current release versions.
#
# Usage:
# python3 update_bug_template.py <template> <tft> <firmware> <blueprint>
#
# Arguments:
# template Path to the bug report template YAML file.
# tft Minimum required TFT version (e.g. "15").
# firmware Current ESPHome firmware version (e.g. "2026.4.2").
# blueprint Minimum required Blueprint version (e.g. "2026.4.2").
#
# Each placeholder is located by the label that precedes it, making the
# update index-independent and safe against future template reordering.

import re
import sys


def update_placeholder(content: str, label: str, value: str) -> tuple[str, int]:
"""Replace the placeholder value following a given label field.
Matches the label and the next placeholder: line using MULTILINE mode
with line anchors, replacing only the value after 'e.g., '.
Does NOT use DOTALL — the trailing match is restricted to non-newline
characters to avoid consuming content beyond the target line.
Args:
content: Full file content as a string.
label: The label text to anchor the search (e.g. 'TFT Version').
value: The new placeholder value to set.
Returns:
Tuple of (updated content, number of replacements made).
Returns (content, 0) if the label is not found.
"""
pattern = (
r'(^\s*label:\s*' + re.escape(label) +
r'\s*$[\s\S]*?\s*placeholder:\s*)e\.g\.,[ \t]*[^\n\r]*'
)
replacement = r'\g<1>e.g., ' + value
updated, count = re.subn(
pattern,
replacement,
content,
count=1,
flags=re.MULTILINE,
)
return updated, count


def main() -> None:
if len(sys.argv) != 5:
print(
f'Usage: {sys.argv[0]} <template> <tft> <firmware> <blueprint>',
file=sys.stderr,
)
sys.exit(1)

template_path = sys.argv[1]
tft_version = sys.argv[2]
firmware_version = sys.argv[3]
blueprint_version = sys.argv[4]

with open(template_path, encoding='utf-8') as f:
content = f.read()

replacements = [
('TFT Version', tft_version),
('Firmware Version', firmware_version),
('Blueprint Version', blueprint_version),
]

errors = []
for label, value in replacements:
content, count = update_placeholder(content, label, value)
if count != 1:
errors.append(
f" '{label}': expected 1 replacement, got {count}"
)

if errors:
print('ERROR: placeholder update failed:', file=sys.stderr)
for error in errors:
print(error, file=sys.stderr)
print(
'Check that the label names in the template have not been renamed.',
file=sys.stderr,
)
sys.exit(2)

with open(template_path, 'w', encoding='utf-8') as f:
f.write(content)

print(f'Updated placeholders in {template_path}:')
print(f' TFT Version: e.g., {tft_version}')
print(f' Firmware Version: e.g., {firmware_version}')
print(f' Blueprint Version: e.g., {blueprint_version}')


if __name__ == '__main__':
main()
91 changes: 91 additions & 0 deletions .github/workflows/esphome_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,95 @@ jobs:
substitutions: |
ref_name=${{ env.REF_NAME }}
ref_url=${{ env.REF_URL }}
# ===========================================================================
# Pre-built firmware - ESPHome Latest
# ===========================================================================
build_prebuilt_latest:
name: ${{ matrix.firmware.name }} - Pre-built (latest)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
firmware:
- name: NSPanel Easy
yaml-file: prebuilt/nspanel_esphome_prebuilt.yaml
- name: Wall Display
yaml-file: prebuilt/wall_display.yaml
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Build firmware
uses: edwardtfn/build-action@add-substitutions-support
with:
yaml-file: ${{ matrix.firmware.yaml-file }}
substitutions: |
ref_name=${{ env.REF_NAME }}
ref_url=${{ env.REF_URL }}
- name: Verify compiled output
run: |
# Locate the binary produced by the build action.
# Using find avoids hardcoding the device name from the YAML.
BIN=$(find prebuilt/.esphome/build -name "firmware.bin" | head -1)
BIN_FACTORY=$(find prebuilt/.esphome/build -name "firmware-factory.bin" | head -1)
ok=true
if [ ! -s "$BIN" ]; then
echo "ERROR: firmware.bin missing or empty"
ok=false
else
echo "OK: firmware.bin ($(wc -c < "$BIN") bytes)"
fi
if [ -n "$BIN_FACTORY" ] && [ ! -s "$BIN_FACTORY" ]; then
echo "ERROR: firmware-factory.bin found but empty"
ok=false
elif [ -n "$BIN_FACTORY" ]; then
echo "OK: firmware-factory.bin ($(wc -c < "$BIN_FACTORY") bytes)"
fi
[ "$ok" = true ] || exit 1
# ===========================================================================
# Pre-built firmware - ESPHome Dev
# ===========================================================================
build_prebuilt_dev:
name: ${{ matrix.firmware.name }} - Pre-built (dev)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
firmware:
- name: NSPanel Easy
yaml-file: prebuilt/nspanel_esphome_prebuilt.yaml
- name: Wall Display
yaml-file: prebuilt/wall_display.yaml
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Build firmware
uses: edwardtfn/build-action@add-substitutions-support
with:
yaml-file: ${{ matrix.firmware.yaml-file }}
version: dev
substitutions: |
ref_name=${{ env.REF_NAME }}
ref_url=${{ env.REF_URL }}
- name: Verify compiled output
run: |
# Locate the binary produced by the build action.
# Using find avoids hardcoding the device name from the YAML.
BIN=$(find prebuilt/.esphome/build -name "firmware.bin" | head -1)
BIN_FACTORY=$(find prebuilt/.esphome/build -name "firmware-factory.bin" | head -1)
ok=true
if [ ! -s "$BIN" ]; then
echo "ERROR: firmware.bin missing or empty"
ok=false
else
echo "OK: firmware.bin ($(wc -c < "$BIN") bytes)"
fi
if [ -n "$BIN_FACTORY" ] && [ ! -s "$BIN_FACTORY" ]; then
echo "ERROR: firmware-factory.bin found but empty"
ok=false
elif [ -n "$BIN_FACTORY" ]; then
echo "OK: firmware-factory.bin ($(wc -c < "$BIN_FACTORY") bytes)"
fi
[ "$ok" = true ] || exit 1
...
Loading
Loading