Create workflow.yml #27
Workflow file for this run
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.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=($(cat $GITHUB_WORKSPACE/yaml_files.txt)) | |
matrix_json="{\"target\": [" | |
for yaml_file in "${yaml_files[@]}"; do | |
matrix_json="$matrix_json{\"yaml_file\": \"$yaml_file\"}," | |
done | |
matrix_json="${matrix_json%,}]}" | |
echo "::set-output name=matrix::$matrix_json" | |
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 |