Fixes for Omada template + build mode improvement #62
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 Trigger | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- closed | |
branches: | |
- main | |
paths: | |
- ".github/workflows/trigger.yml" | |
- "./templates/*" | |
schedule: | |
- cron: "0 0 */7 * *" | |
workflow_dispatch: | |
jobs: | |
init: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: List all templates | |
id: all-templates-list | |
run: | | |
sudo apt-get install -y jq | |
echo all_files="$(ls templates/* | jq -Rsc 'split("\n")[:-1]')" | tee -a $GITHUB_OUTPUT | |
if: ${{github.event_name}} != 'pull_request' | |
- name: List changed templates | |
id: all-changed-templates-list | |
uses: tj-actions/changed-files@v45 | |
with: | |
since_last_remote_commit: true | |
files: templates/** | |
if: ${{github.event_name}} == 'pull_request' | |
- name: Check templates list | |
id: check-templates-list | |
run: | | |
echo ALL_TEMPLATES=${{ steps.all-templates-list.outputs.all_files }} | |
echo ALL_CHANGED_TEMPLATES=${{ steps.all-changed-templates-list.outputs.all_changed_files }} | |
echo TEMPLATES_LIST=${{ steps.all-changed-templates-list.outputs.all_changed_files && steps.all-changed-templates-list.outputs.all_changed_files || steps.all-templates-list.outputs.all_files }}| tee -a $GITHUB_OUTPUT | |
outputs: | |
templates_list: ${{steps.check-templates-list.outputs.TEMPLATES_LIST}} | |
image-build: | |
needs: init | |
strategy: | |
fail-fast: false | |
matrix: | |
templates: ${{ fromJson(needs.init.outputs.templates_list) }} | |
uses: ./.github/workflows/builder.yml | |
with: | |
config_path: ${{matrix.templates}} | |
branch_name: ${{github.event.pull_request.base.ref}} | |
is_merged: ${{github.event.pull_request.merged || github.event_name == 'schedule'}} | |
secrets: inherit |