Build ESPHome #4069
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: Build ESPHome | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: '0 */6 * * *' | |
jobs: | |
matrix_maker: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.create_matrix.outputs.matrix }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create yaml file matrix | |
id: create_matrix | |
run: | | |
# Read the list of YAML files and create a matrix | |
yaml_files=$(find . -not -name "secrets.yaml" -maxdepth 1 -type f -name "*.yaml" -exec echo {} \; | tr '\n' ' ') | |
yaml_array="[\"$(echo "$yaml_files" | sed 's/ /", "/g')\"]" | |
yaml_array=$(echo $yaml_array | sed 's/.....$/]/') | |
DATA=$(echo $yaml_array | jq -c ) | |
echo "matrix=$DATA" >> $GITHUB_OUTPUT | |
- name: Debug output | |
run: echo "${{ steps.create_matrix.outputs.matrix }}" | |
build: | |
needs: matrix_maker | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
name: ${{ fromJSON(needs.matrix_maker.outputs.matrix) }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: "Replace component branch reference" | |
run: sed -i "s|@main \#update_to_head_ref|@${{ github.head_ref }}|g" ${{ matrix.name }} | |
- name: Debug output | |
run: cat ${{ matrix.name }} | |
- name: CLang Format Lint | |
uses: DoozyX/[email protected] | |
with: | |
source: '.' | |
extensions: 'h,cpp' | |
style: file | |
exclude: '*/version.h' | |
clangFormatVersion: 15 | |
- name: Create secrets file | |
run: | | |
echo "d2lmaV9ic3NpZDogIjFDOjg3OjJDOjcwOkMyOkMyIgp3aWZpX3NzaWQ6ICJzc2lkIgp3aWZpX3Bhc3N3b3JkOiAid2lmaXBhc3MiCndpZmlfZmFsbGJhY2tfcGFzc3dvcmQ6ICJ3aWZpZmFsbGJhY2twYXNzIgphcGlfZW5jcnlwdGlvbjogImFwaWVuY3J5cHRpb24iCm90YV9lbmNyeXB0aW9uOiAib3RhZW5jcnlwdGlvbiIK" | base64 --decode > secrets.yaml | |
- name: Build esphome | |
uses: esphome/[email protected] | |
with: | |
# version: dev | |
yaml_file: ${{ matrix.name }} |