Skip to content

Commit

Permalink
Merge pull request #58 from Columbo/dev
Browse files Browse the repository at this point in the history
Add workflow to build a bin artifact if full.yaml changes
  • Loading branch information
wrfz authored Nov 5, 2024
2 parents e27fe5e + a6d19b8 commit cc81417
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Compile ESPHome Binary

on:
push:
branches:
- main
- dev
paths:
- 'examples/full.yaml'
- 'components/**'

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
run: |
python -m pip install esphome
- name: Compile ESPHome binary
run: |
cp .github/workflows/resources/secrets.yaml .
cp examples/full.yaml .
esphome compile full.yaml
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
4 changes: 4 additions & 0 deletions .github/workflows/resources/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
api_encryption_key: !env_var API_ENCRYPTION_KEY
ota_password: !env_var OTA_PASSWORD
wifi_ssid: !env_var WIFI_SSID
wifi_password: !env_var WIFI_PASSWORD
1 change: 1 addition & 0 deletions examples/full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ esp32:
external_components:
- source: github://Trunks1982/Daikin-Rotex-HPSU-CAN

#
#external_components: # Use this block instead of the one above if you want to use the development branch
# - source:
# type: git
Expand Down

0 comments on commit cc81417

Please sign in to comment.