Fix of malfunction detection for valves #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Compile ESPHome Binary | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
paths: | |
- 'examples/full.yaml' | |
- 'components/**' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check for required secrets | |
run: | | |
if [ -z "${{ secrets.API_ENCRYPTION_KEY }}" ]; then | |
echo "Error: API_ENCRYPTION_KEY secret is not set" >&2 | |
exit 1 | |
fi | |
if [ -z "${{ secrets.OTA_PASSWORD }}" ]; then | |
echo "Error: OTA_PASSWORD secret is not set" >&2 | |
exit 1 | |
fi | |
if [ -z "${{ secrets.WIFI_SSID }}" ]; then | |
echo "Error: WIFI_SSID secret is not set" >&2 | |
exit 1 | |
fi | |
if [ -z "${{ secrets.WIFI_PASSWORD }}" ]; then | |
echo "Error: WIFI_PASSWORD secret is not set" >&2 | |
exit 1 | |
fi | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Set environment variables | |
run: | | |
echo "API_ENCRYPTION_KEY=${{ secrets.API_ENCRYPTION_KEY }}" >> $GITHUB_ENV | |
echo "OTA_PASSWORD=${{ secrets.OTA_PASSWORD }}" >> $GITHUB_ENV | |
echo "WIFI_SSID=${{ secrets.WIFI_SSID }}" >> $GITHUB_ENV | |
echo "WIFI_PASSWORD=${{ secrets.WIFI_PASSWORD }}" >> $GITHUB_ENV | |
- name: Install ESPHome and cels | |
run: | | |
python3 -m pip install esphome | |
# install latest version of cels by using wget, otherwise version 0.1.0 would be installed, which is buggy | |
wget https://files.pythonhosted.org/packages/18/82/14819c1cc67c67e909abdbd9824eb756adccd47a1dee1c846f7300716646/cels-0.3.1.tar.gz | |
python3 -m pip install cels-0.3.1.tar.gz | |
- name: Prepare full.yaml | |
run: | | |
cp examples/full.yaml . | |
cp .github/workflows/resources/secrets.yaml . | |
cp .github/workflows/src/extract_external_components_block.py . | |
cp .github/workflows/src/patch_full_yaml.sh . | |
if [ "${{ github.ref }}" == "refs/heads/dev" ]; then | |
echo "dev branch run, take external components from dev branch" | |
source patch_full_yaml.sh | |
else | |
echo "not dev branch run, take external components from main" | |
fi | |
# print path used for external components | |
echo "The following external components will be used for compilation: " | |
python extract_external_components_block.py | |
- name: Compile ESPHome binary | |
run: | | |
# compile eshphome | |
esphome compile full.yaml | |
# rename file | |
mv .esphome/build/rotex/.pioenvs/rotex/firmware.factory.bin .esphome/build/rotex/.pioenvs/rotex/rotex.factory-gpios-tx05-rx06.bin | |
- name: Archive compiled binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: compiled-binary | |
path: .esphome/build/rotex/.pioenvs/rotex/rotex.factory-gpios-tx05-rx06.bin |