@@ -14,11 +14,9 @@ permissions:
1414 packages : write
1515
1616jobs :
17- changes :
18- name : Detect changed files
17+ detect- changes :
18+ name : Detect changes
1919 runs-on : ubuntu-latest
20- permissions :
21- pull-requests : read
2220 outputs :
2321 server : ${{ steps.filter.outputs.server }}
2422 chart : ${{ steps.filter.outputs.chart }}
@@ -39,33 +37,101 @@ jobs:
3937 parser:
4038 - 'parser/**'
4139
42- build-and-push :
43- needs : changes
40+ build-server :
41+ name : Build server
42+ needs : detect-changes
43+ if : needs.detect-changes.outputs.server == 'true'
4444 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
45+ steps :
46+ - uses : actions/checkout@v4
47+ - uses : docker/setup-buildx-action@v3
48+ - uses : docker/login-action@v3
49+ with :
50+ registry : ${{ env.REGISTRY }}
51+ username : ${{ github.actor }}
52+ password : ${{ secrets.GITHUB_TOKEN }}
53+ - id : meta
54+ uses : docker/metadata-action@v5
55+ with :
56+ images : ${{ env.IMAGE_PREFIX }}-server
57+ tags : |
58+ type=raw,value=latest
59+ type=ref,event=branch
60+ type=sha
61+ - uses : docker/build-push-action@v5
62+ with :
63+ file : ./server/Dockerfile
64+ context : .
65+ push : true
66+ tags : ${{ steps.meta.outputs.tags }}
67+ labels : ${{ steps.meta.outputs.labels }}
68+ platforms : linux/amd64,linux/arm64
69+
70+ build-chart :
71+ name : Build chart
72+ needs : detect-changes
73+ if : needs.detect-changes.outputs.chart == 'true'
74+ runs-on : ubuntu-latest
75+ steps :
76+ - uses : actions/checkout@v4
77+ - uses : docker/setup-buildx-action@v3
78+ - uses : docker/login-action@v3
79+ with :
80+ registry : ${{ env.REGISTRY }}
81+ username : ${{ github.actor }}
82+ password : ${{ secrets.GITHUB_TOKEN }}
83+ - id : meta
84+ uses : docker/metadata-action@v5
85+ with :
86+ images : ${{ env.IMAGE_PREFIX }}-chart
87+ tags : |
88+ type=raw,value=latest
89+ type=ref,event=branch
90+ type=sha
91+ - uses : docker/build-push-action@v5
92+ with :
93+ file : ./chart/Dockerfile
94+ context : ./chart
95+ push : true
96+ tags : ${{ steps.meta.outputs.tags }}
97+ labels : ${{ steps.meta.outputs.labels }}
98+ platforms : linux/amd64,linux/arm64
99+
100+ build-web :
101+ name : Build web
102+ needs : detect-changes
103+ if : needs.detect-changes.outputs.web == 'true'
104+ runs-on : ubuntu-latest
105+ steps :
106+ - uses : actions/checkout@v4
107+ - uses : docker/setup-buildx-action@v3
108+ - uses : docker/login-action@v3
109+ with :
110+ registry : ${{ env.REGISTRY }}
111+ username : ${{ github.actor }}
112+ password : ${{ secrets.GITHUB_TOKEN }}
113+ - id : meta
114+ uses : docker/metadata-action@v5
115+ with :
116+ images : ${{ env.IMAGE_PREFIX }}-web
117+ tags : |
118+ type=raw,value=latest
119+ type=ref,event=branch
120+ type=sha
121+ - uses : docker/build-push-action@v5
122+ with :
123+ file : ./web/Dockerfile
124+ context : .
125+ push : true
126+ tags : ${{ steps.meta.outputs.tags }}
127+ labels : ${{ steps.meta.outputs.labels }}
128+ platforms : linux/amd64,linux/arm64
64129
65- if : ${{ matrix.changed == 'true' }}
66- defaults :
67- run :
68- shell : bash
130+ build-parser :
131+ name : Build parser
132+ needs : detect-changes
133+ if : needs.detect-changes.outputs.parser == 'true'
134+ runs-on : ubuntu-latest
69135 steps :
70136 - uses : actions/checkout@v4
71137 - uses : docker/setup-buildx-action@v3
@@ -77,15 +143,15 @@ jobs:
77143 - id : meta
78144 uses : docker/metadata-action@v5
79145 with :
80- images : ${{ env.IMAGE_PREFIX }}-${{ matrix.name }}
146+ images : ${{ env.IMAGE_PREFIX }}-parser
81147 tags : |
82148 type=raw,value=latest
83149 type=ref,event=branch
84150 type=sha
85151 - uses : docker/build-push-action@v5
86152 with :
87- file : ${{ matrix.file }}
88- context : ${{ matrix.context }}
153+ file : ./parser/Dockerfile
154+ context : .
89155 push : true
90156 tags : ${{ steps.meta.outputs.tags }}
91157 labels : ${{ steps.meta.outputs.labels }}
0 commit comments