-
Notifications
You must be signed in to change notification settings - Fork 4
41 lines (39 loc) · 1.29 KB
/
monthly_build_check_dockers.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Monthly Docker Build Validation
on:
schedule:
- cron: '57 0 1 * *'
workflow_dispatch:
jobs:
get-dockerfiles:
name: Get Changed Dockerfiles Matrix
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: checkout
uses: actions/checkout@v3
name: Checkout Repo
with:
fetch-depth: 0
- id: set-matrix
name: Changed Dockerfiles String to Matrix
run: |
MATRIX=$(find * -name Dockerfile | xargs -I{} dirname {} | jq -Rrs 'split("\n") | map(select(. != "")) | map(rtrimstr("/Dockerfile")) | map({"path": ., "image": (. | split("/")[0] | ascii_downcase), "tag": (. | split("/")[1] // "latest")}) | @json')
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
build-dockerfiles:
name: Build ${{ matrix.path }}
needs: get-dockerfiles
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.get-dockerfiles.outputs.matrix) }}
steps:
- id: docker-buildx-setup
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- id: test-build
name: Test Build Dockerfile
uses: docker/build-push-action@v4
with:
context: "{{defaultContext}}:${{ matrix.path }}"