-
Notifications
You must be signed in to change notification settings - Fork 23
79 lines (69 loc) · 2.32 KB
/
custom_docker_builds.yml
File metadata and controls
79 lines (69 loc) · 2.32 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Build Docker Images
on:
push:
branches:
- main
paths:
- analytics/**
- images/**
- .github/workflows/custom_docker_builds.yml
pull_request:
branches:
- main
paths:
- analytics/**
- images/**
- .github/workflows/custom_docker_builds.yml
jobs:
check-modified-dirs:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
matrix: ${{ steps.dataStep.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- id: dataStep
run: |
echo "matrix"=$(.github/scripts/get_custom_image_build_matrix.sh) >> $GITHUB_OUTPUT
env:
EVENT_TYPE: ${{ github.event_name }}
COMMITS: ${{ toJSON(github.event.commits) }}
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: check-modified-dirs
if: ${{ needs.check-modified-dirs.outputs.matrix }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.check-modified-dirs.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Log in to the Container registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
logout: false
- name: Build ${{ (github.ref == 'refs/heads/main' && 'and push ') || '' }}${{ matrix.docker-image }}
id: docker-build-push
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: ${{ matrix.docker-image }}
file: ${{ matrix.docker-image }}/Dockerfile
push: ${{ github.ref == 'refs/heads/main' }} # only publish image on push to main
tags: ${{ matrix.image-tags }}
platforms: linux/amd64,linux/arm64
- name: Image digest
run: echo ${{ steps.docker-build-push.outputs.digest }}