Skip to content

Merge branch 'main' of github.com:geek-cookbook/containers #1346

Merge branch 'main' of github.com:geek-cookbook/containers

Merge branch 'main' of github.com:geek-cookbook/containers #1346

---
name: "Image: Rebuild"
on:
push:
branches:
- main
paths:
- "apps/**"
- "!apps/**/metadata.json"
- "!apps/**/README.md"
jobs:
get-changes:
name: Collect changes
runs-on: ubuntu-latest
outputs:
addedOrModifiedImages: ${{ steps.collect-changes.outputs.addedOrModifiedImages }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Collect changes
id: collect-changes
uses: ./.github/actions/collect-changes
generate-build-matrix:
name: Generate matrix for building images
runs-on: ubuntu-latest
needs:
- get-changes
outputs:
matrix: ${{ steps.get-changed.outputs.changes }}
if: ${{ needs.get-changes.outputs.addedOrModifiedImages }} != '[]'
steps:
- name: Install tools
run: |
sudo apt-get update
sudo apt-get -y install moreutils jo
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch modified images
id: get-changed
shell: bash
run: |
declare -a changes_array=()
while read -r app
do
while read -r channel
do
change="$(jo app="$app" channel="$channel")"
changes_array+=($change)
done < <(jq -r '.channels[] | .name' "./apps/$app/metadata.json")
done < <(echo '${{ needs.get-changes.outputs.addedOrModifiedImages }}' | jq --raw-output -c '.[]')
output="$(jo -a ${changes_array[*]})"
echo "::set-output name=changes::${output}"
images-build:
uses: elfhosted/containers/.github/workflows/action-image-build.yaml@main
needs:
- generate-build-matrix
with:
imagesToBuild: "${{ needs.generate-build-matrix.outputs.matrix }}"
pushImages: "true"
updateMetadata: "true"
sendNotification: "true"
secrets: inherit