Skip to content

Merge pull request #769 from thomshaw92/master #550

Merge pull request #769 from thomshaw92/master

Merge pull request #769 from thomshaw92/master #550

Workflow file for this run

name: auto-build
on:
push:
paths:
- recipes/**
branches:
- master
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 }}
runner: ${{ steps.select_runner.outputs.runner }}
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
- name: Select runner
id: select_runner
run: |
if [ "${{ github.repository }}" = "NeuroDesk/neurocontainers" ]; then
echo "runner=[\"self-hosted\"]" >> $GITHUB_OUTPUT
else
echo "runner=[\"ubuntu-22.04\"]" >> $GITHUB_OUTPUT
fi
build-apps:
needs: list-apps
uses: ./.github/workflows/build-apps.yml
with:
applications: ${{ needs.list-apps.outputs.app_list }}
runner: ${{ needs.list-apps.outputs.runner }}
secrets: inherit