Skip to content

Create workflow.yml #33

Create workflow.yml

Create workflow.yml #33

Workflow file for this run

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.set-matrix.outputs.result }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: devices
- 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/.....$/])/')
echo "matrix=$yaml_array" >> $GITHUB_OUTPUT
- name: Debug output
run: echo "${{ steps.create_matrix.outputs.matrix }}"
build:
runs-on: ubuntu-latest
needs: matrix_maker
strategy:
matrix:
version: ${{ fromJSON(needs.matrix_maker.outputs.matrix) }}
steps:
- uses: actions/checkout@v2
- uses: DoozyX/[email protected]
with:
source: '.'
extensions: 'h,cpp'
style: file
exclude: '*/version.h'
clangFormatVersion: 15
- name: Create file
run: |
echo "d2lmaV9ic3NpZDogIjFDOjg3OjJDOjcwOkMyOkMyIgp3aWZpX3NzaWQ6ICJzc2lkIgp3aWZpX3Bhc3N3b3JkOiAid2lmaXBhc3MiCndpZmlfZmFsbGJhY2tfcGFzc3dvcmQ6ICJ3aWZpZmFsbGJhY2twYXNzIgphcGlfZW5jcnlwdGlvbjogImFwaWVuY3J5cHRpb24iCm90YV9lbmNyeXB0aW9uOiAib3RhZW5jcnlwdGlvbiIK" | base64 --decode > secrets.yaml
- name: Build esphome
uses: esphome/[email protected]
with:
yaml_file: ${{ matrix.name }}.yaml