Skip to content

Add frient A/S EMI Norwegian HAN (EMIZB-132) v4.0.7 (#66) #35

Add frient A/S EMI Norwegian HAN (EMIZB-132) v4.0.7 (#66)

Add frient A/S EMI Norwegian HAN (EMIZB-132) v4.0.7 (#66) #35

name: Update dev channel OTA index files
on:
workflow_dispatch:
push:
branches:
- dev
paths:
- "images/**"
- ".github/SCHEMA.json"
concurrency:
group: update-dev-json
cancel-in-progress: false
env:
PYTHON_VERSION_DEFAULT: "3.14"
jobs:
# Generate index files in a read-only job to isolate OTA image parsing
# from privileged push operations
generate-index:
name: Generate OTA index files
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
# Shallow clone is sufficient — this job only reads files from the working tree.
# Full history is only needed by update-release-files (which switches branches).
- name: Checkout repository
uses: actions/checkout@v6
- name: Load schema config
run: |
set -euo pipefail
{
echo "TMP_ZIGPY=/tmp/$(jq -r '.zigpy_filename' .github/SCHEMA.json)"
echo "TMP_Z2M=/tmp/$(jq -r '.z2m_filename' .github/SCHEMA.json)"
echo "TMP_MARKDOWN=/tmp/$(jq -r '.markdown_filename' .github/SCHEMA.json)"
} >> "$GITHUB_ENV"
- name: Set up Python ${{ env.PYTHON_VERSION_DEFAULT }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install package
run: uv sync --group ci
- name: Generate zigpy JSON metadata (dev channel)
run: |
uv run zigpy-ota generate-index \
--format zigpy \
--channel dev \
--output-file "$TMP_ZIGPY"
- name: Generate Z2M JSON metadata (dev channel)
run: |
uv run zigpy-ota generate-index \
--format z2m \
--channel dev \
--output-file "$TMP_Z2M"
- name: Generate markdown index (dev channel)
run: |
uv run zigpy-ota generate-index \
--format markdown \
--channel dev \
--output-file "$TMP_MARKDOWN"
- name: Upload generated index files
uses: actions/upload-artifact@v7
with:
name: dev-index-files
if-no-files-found: error
retention-days: 1
path: |
${{ env.TMP_ZIGPY }}
${{ env.TMP_Z2M }}
${{ env.TMP_MARKDOWN }}
update-release-files:
name: Commit index files to release/files branch
needs: [generate-index]
permissions: {}
runs-on: ubuntu-slim
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.BOT_ACCESS_TOKEN }}
- name: Download generated index files
uses: actions/download-artifact@v8
with:
name: dev-index-files
path: /tmp/index-files
- name: Configure git
run: |
set -euo pipefail
git config --global user.name "zigpy-bot"
git config --global user.email "247691930+zigpy-bot@users.noreply.github.com"
- name: Commit and push changes to release/files
run: |
set -euo pipefail
# Switch to release/files branch or create it if it doesn't exist
git fetch origin release/files:release/files || git checkout -b release/files
git checkout release/files
# Copy all generated index files to the dev directory
mkdir -p dev
cp /tmp/index-files/* dev/
# Add, commit, and push if there are changes
git add dev/
git diff --staged --quiet || git commit -m "Update \`dev\` OTA index files"
git push origin release/files