44 push :
55 branches :
66 - main
7- workflow_dispatch :
87
98env :
109 REGISTRY : ghcr.io
@@ -40,11 +39,33 @@ jobs:
4039 parser:
4140 - 'parser/**'
4241
43- build-and-push-server :
42+ build-and-push :
4443 needs : changes
45- if : ${{ needs.changes.outputs.server == 'true' }}
4644 runs-on : ubuntu-latest
45+ strategy :
46+ matrix :
47+ include :
48+ - name : server
49+ changed : ${{ needs.changes.outputs.server }}
50+ context : .
51+ file : ./server/Dockerfile
52+ - name : chart
53+ changed : ${{ needs.changes.outputs.chart }}
54+ context : ./chart
55+ file : ./chart/Dockerfile
56+ - name : web
57+ changed : ${{ needs.changes.outputs.web }}
58+ context : .
59+ file : ./web/Dockerfile
60+ - name : parser
61+ changed : ${{ needs.changes.outputs.parser }}
62+ context : .
63+ file : ./parser/Dockerfile
4764
65+ if : ${{ matrix.changed == 'true' }}
66+ defaults :
67+ run :
68+ shell : bash
4869 steps :
4970 - uses : actions/checkout@v4
5071 - uses : docker/setup-buildx-action@v3
@@ -56,116 +77,16 @@ jobs:
5677 - id : meta
5778 uses : docker/metadata-action@v5
5879 with :
59- images : ${{ env.IMAGE_PREFIX }}-server
80+ images : ${{ env.IMAGE_PREFIX }}-${{ matrix.name }}
6081 tags : |
6182 type=raw,value=latest
6283 type=ref,event=branch
6384 type=sha
6485 - uses : docker/build-push-action@v5
6586 with :
66- file : ./server/Dockerfile
67- context : .
87+ file : ${{ matrix.file }}
88+ context : ${{ matrix.context }}
6889 push : true
6990 tags : ${{ steps.meta.outputs.tags }}
7091 labels : ${{ steps.meta.outputs.labels }}
7192 platforms : linux/amd64,linux/arm64
72-
73- build-and-push-chart :
74- needs : changes
75- if : ${{ needs.changes.outputs.chart == 'true' }}
76- runs-on : ubuntu-latest
77- permissions :
78- contents : read
79- packages : write
80-
81- steps :
82- - uses : actions/checkout@v4
83- - uses : docker/setup-buildx-action@v3
84- - uses : docker/login-action@v3
85- with :
86- registry : ${{ env.REGISTRY }}
87- username : ${{ github.actor }}
88- password : ${{ secrets.GITHUB_TOKEN }}
89- - id : meta
90- uses : docker/metadata-action@v5
91- with :
92- images : ${{ env.IMAGE_PREFIX }}-chart
93- tags : |
94- type=raw,value=latest
95- type=ref,event=branch
96- type=sha
97- - uses : docker/build-push-action@v5
98- with :
99- file : ./chart/Dockerfile
100- context : ./chart
101- push : true
102- tags : ${{ steps.meta.outputs.tags }}
103- labels : ${{ steps.meta.outputs.labels }}
104- platforms : linux/amd64,linux/arm64
105-
106- build-and-push-web :
107- needs : changes
108- if : ${{ needs.changes.outputs.web == 'true' }}
109- runs-on : ubuntu-latest
110- permissions :
111- contents : read
112- packages : write
113-
114- steps :
115- - uses : actions/checkout@v4
116- - uses : docker/setup-buildx-action@v3
117- - uses : docker/login-action@v3
118- with :
119- registry : ${{ env.REGISTRY }}
120- username : ${{ github.actor }}
121- password : ${{ secrets.GITHUB_TOKEN }}
122- - id : meta
123- uses : docker/metadata-action@v5
124- with :
125- images : ${{ env.IMAGE_PREFIX }}-web
126- tags : |
127- type=raw,value=latest
128- type=ref,event=branch
129- type=sha
130- - uses : docker/build-push-action@v5
131- with :
132- file : ./web/Dockerfile
133- context : .
134- push : true
135- tags : ${{ steps.meta.outputs.tags }}
136- labels : ${{ steps.meta.outputs.labels }}
137- platforms : linux/amd64,linux/arm64
138-
139- build-and-push-parser :
140- needs : changes
141- if : ${{ needs.changes.outputs.parser == 'true' }}
142- runs-on : ubuntu-latest
143- permissions :
144- contents : read
145- packages : write
146-
147- steps :
148- - uses : actions/checkout@v4
149- - uses : docker/setup-buildx-action@v3
150- - uses : docker/login-action@v3
151- with :
152- registry : ${{ env.REGISTRY }}
153- username : ${{ github.actor }}
154- password : ${{ secrets.GITHUB_TOKEN }}
155- - id : meta
156- uses : docker/metadata-action@v5
157- with :
158- images : ${{ env.IMAGE_PREFIX }}-parser
159- tags : |
160- type=raw,value=latest
161- type=ref,event=branch
162- type=sha
163- - uses : docker/build-push-action@v5
164- with :
165- file : ./parser/Dockerfile
166- context : .
167- push : true
168- tags : ${{ steps.meta.outputs.tags }}
169- labels : ${{ steps.meta.outputs.labels }}
170- platforms : linux/amd64,linux/arm64
171-
0 commit comments