-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from Columbo/dev
Add workflow to build a bin artifact if full.yaml changes
- Loading branch information
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
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
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 |
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