@@ -47,15 +47,38 @@ jobs:
4747 echo "update_needed=true" >> $GITHUB_OUTPUT
4848 fi
4949
50- - name : Update manifest.json with new version
50+ - name : Update dependency pins with new version
5151 if : steps.check_update.outputs.update_needed == 'true'
5252 run : |
53+ set -e
5354 latest="${{ steps.get_release.outputs.latest_version }}"
55+
56+ # Pin integration runtime dependency.
5457 jq \
5558 --arg v "$latest" \
5659 '.requirements[0] = "victron_mqtt=="+$v' \
5760 custom_components/victron_mqtt/manifest.json > manifest.tmp && mv manifest.tmp custom_components/victron_mqtt/manifest.json
5861
62+ # Pin local/dev test dependency.
63+ sed -i -E "s|^victron_mqtt(==[0-9][0-9A-Za-z.\-]*)?$|victron_mqtt==$latest|" requirements.txt
64+
65+ # Ensure CI test job installs the same victron_mqtt version.
66+ python3 - <<'PY'
67+ from pathlib import Path
68+ import re
69+
70+ latest = "${{ steps.get_release.outputs.latest_version }}"
71+ workflow = Path(".github/workflows/validate.yaml")
72+ text = workflow.read_text(encoding="utf-8")
73+
74+ pattern = re.compile(r"(pip install [^\n]*?)victron_mqtt(?:==[^\s]+)?", re.MULTILINE)
75+ updated_text, count = pattern.subn(rf"\1victron_mqtt=={latest}", text, count=1)
76+ if count != 1:
77+ raise RuntimeError("Could not update victron_mqtt pin in .github/workflows/validate.yaml")
78+
79+ workflow.write_text(updated_text, encoding="utf-8")
80+ PY
81+
5982 - name : Download victron_mqtt release package from PyPI
6083 if : steps.check_update.outputs.update_needed == 'true'
6184 run : |
0 commit comments