diff --git a/.github/workflows/build_latest.yaml b/.github/workflows/build_latest.yaml index d673334b..851d0dbf 100644 --- a/.github/workflows/build_latest.yaml +++ b/.github/workflows/build_latest.yaml @@ -5,9 +5,6 @@ on: branches: - main - develop - paths: - - '.github/**' - - 'config/satellite*' pull_request: workflow_dispatch: release: @@ -17,54 +14,70 @@ env: DEFAULT_PYTHON: "3.9" jobs: - build-list-all: + build-list: runs-on: ubuntu-latest outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} + build_firmware: ${{ steps.final_list.outputs.build_firmware }} + build_cfg_files: ${{ steps.final_list.outputs.files }} steps: - name: Check out code from GitHub - uses: actions/checkout@v4.1.6 + uses: actions/checkout@v4.1.6 + - name: Find all YAML satellite files - id: set-matrix - run: echo "matrix=$(ls config/satellite*.yaml | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT - - build-list: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.convert_to_list.outputs.matrix }} - any_changed: ${{ steps.changed-satellite-files.outputs.any_changed }} - files: ${{ steps.changed-satellite-files.outputs.all_changed_files }} - steps: - - name: Get all changed satellite files - id: changed-satellite-files + id: all-satellite-files + run: | + echo "matrix=$(ls config/satellite*.yaml | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT + echo "all_files=$(ls config/satellite*.yaml | jq --slurp --raw-input )" >> $GITHUB_OUTPUT + + - name: Get changed files + id: changed-files uses: tj-actions/changed-files@v44 with: # Avoid using single or double quotes for multiline patterns - files: | - config/satellite*.yaml - - name: convert to new line separated string - id: convert_to_list + files_yaml: | + core: + - config/satellite*.yaml + includes: + - config/common/*.yaml + + - name: create actual list + id: final_list env: - CHANGED_FILES: ${{ steps.changed-satellite-files.outputs.all_changed_files }} + INCLUDES_CHANGED: ${{ steps.changed-files.outputs.includes_any_changed }} + CORE_HAS_CHANGED: ${{ steps.changed-files.outputs.core_any_changed }} + CHANGED_CORE_FILES: ${{ steps.changed-files.outputs.core_all_changed_files }} + run: | - ARR=() - for file in ${CHANGED_FILES}; do - echo "$file was changed" - ARR+=($file) - done - echo "matrix=$( printf '%s\n' "${ARR[@]}" | jq --slurp --raw-input)" >> $GITHUB_OUTPUT - - build-firmware-changed: - if: needs.build-list.outputs.any_changed == 'True' + if [[ ${INCLUDES_CHANGED} == "true" ]]; then + echo "build_firmware=true" >> $GITHUB_OUTPUT + echo "matrix=$(ls config/satellite*.yaml | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT + echo "files=$(ls config/satellite*.yaml | jq --slurp --raw-input )" >> $GITHUB_OUTPUT + elif [[ ${CORE_HAS_CHANGED} == "true" ]]; then + ARR=() + for file in ${CHANGED_CORE_FILES}; do + echo "$file was changed" + ARR+=($file) + done + echo "build_firmware=true" >> $GITHUB_OUTPUT + echo "matrix=$( printf '%s\n' "${ARR[@]}" | jq --slurp --raw-input)" >> $GITHUB_OUTPUT + echo "files=$( printf '%s\n' "${ARR[@]}" | jq --slurp --raw-input)" >> $GITHUB_OUTPUT + else + echo "build_firmware=false" >> $GITHUB_OUTPUT + echo "matrix=''" >> $GITHUB_OUTPUT + echo "files=''" >> $GITHUB_OUTPUT + fi + + build-firmware: + if: needs.build-list.outputs.build_firmware == 'true' name: Build Firmware needs: - build-list - uses: esphome/workflows/.github/workflows/build.yml@main with: - files: ${{ fromJSON(needs.build-list.outputs.matrix) }} + files: ${{ fromJSON(needs.build-list.outputs.build_cfg_files) }} esphome-version: 2024.6.0 release-summary: ${{ github.event_name == 'release' && github.event.release.body || '' }} release-url: ${{ github.event_name == 'release' && github.event.release.html_url || '' }} release-version: ${{ github.event_name == 'release' && github.event.release.tag_name || '' }} - \ No newline at end of file + + \ No newline at end of file diff --git a/config/common/everloop.yaml b/config/common/everloop.yaml index ed8c4067..1c85d777 100644 --- a/config/common/everloop.yaml +++ b/config/common/everloop.yaml @@ -26,6 +26,7 @@ light: max_brightness: 100% + script: # Script controlling the LED, based on different conditions: # - initialization in progress, diff --git a/config/satellite_va_core_r1.yaml b/config/satellite_va_core_r1.yaml index fca59b55..2e9b4d46 100644 --- a/config/satellite_va_core_r1.yaml +++ b/config/satellite_va_core_r1.yaml @@ -3,6 +3,7 @@ substitutions: core_revision: "1" LED_PIN: "GPIO5" + packages: device_base: !include common/board.yaml wifi: !include common/wifi_improv.yaml diff --git a/config/satellite_va_core_r2.yaml b/config/satellite_va_core_r2.yaml index cf2c8ad6..ccee2ed7 100644 --- a/config/satellite_va_core_r2.yaml +++ b/config/satellite_va_core_r2.yaml @@ -3,6 +3,7 @@ substitutions: core_revision: "2" LED_PIN: "GPIO14" + packages: device_base: !include common/board.yaml wifi: !include common/wifi_improv.yaml