try again #44
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: auto-build | |
on: | |
push: | |
paths: | |
- recipes/** | |
branches: | |
- main | |
jobs: | |
list-apps: | |
runs-on: ubuntu-22.04 | |
if: ${{ !contains(github.event.head_commit.message, 'skipci') }} | |
outputs: | |
app_list: ${{ steps.find_changed_recipes.outputs.app_list }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Find all recipe directories with changes | |
id: find_changed_dirs | |
uses: tj-actions/changed-files@v41 | |
with: | |
files: "recipes/**" | |
dir_names: "true" | |
json: "true" | |
- name: Filter down to changed recipes | |
id: find_changed_recipes | |
if: steps.find_changed_dirs.outputs.any_changed == 'true' | |
run: | | |
# Get dir changelist -> convert list to json -> extract app name only -> remove duplicate apps | |
changed_recipes=$(echo "${{ steps.find_changed_dirs.outputs.all_changed_files }}" | jq -rc '.[]' | cut -d/ -s -f 2-2 | jq -ncR '[inputs]' | jq -rc 'unique') | |
echo "changed_recipes=${changed_recipes}" | |
app_list='[' | |
for APPLICATION in $(echo "${changed_recipes}" | jq -r '.[]'); do | |
AUTOBUILD=$(cat .github/workflows/build-config.json | jq ".${APPLICATION} .autoBuild") | |
[ "$AUTOBUILD" == "null" ] && AUTOBUILD=$(cat .github/workflows/build-config.json | jq ".default .autoBuild") | |
if [ "$AUTOBUILD" = "true" ]; then | |
app_list+="\"${APPLICATION}\"," | |
else | |
echo "$APPLICATION:autoBuild:$AUTOBUILD in build-config.json" | |
fi | |
done | |
app_list=$(sed '$s/,$//' <<< $app_list) | |
app_list+=']' | |
echo "app_list=${app_list}" | |
echo "app_list=${app_list}" >> $GITHUB_OUTPUT | |
build-apps: | |
needs: list-apps | |
uses: ./.github/workflows/build-apps.yml | |
with: | |
applications: ${{ needs.list-apps.outputs.app_list }} | |
secrets: inherit |