Add ansible container #73
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: "Rebuild images on commit" | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- "apps/**" | |
- "!apps/**/.ci/metadata.yaml" | |
- "!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 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 build | |
do | |
change="$(jo app="$app" build="$build")" | |
changes_array+=($change) | |
done < <(yq -r '.builds[] | .name' "./apps/$app/.ci/metadata.yaml") | |
done < <(echo '${{ needs.get-changes.outputs.addedOrModifiedImages }}' | jq --raw-output -c '.[]') | |
output="$(jo -a ${changes_array[*]})" | |
echo "changes=${output}" >> $GITHUB_OUTPUT | |
images-build: | |
uses: ./.github/workflows/action-image-build.yaml | |
needs: | |
- generate-build-matrix | |
with: | |
imagesToBuild: "${{ needs.generate-build-matrix.outputs.matrix }}" | |
pushImages: "true" | |
secrets: inherit |