Skip to content

Commit 706735e

Browse files
committed
Separate image name and tag inputs in workflows
Refactored `.github/workflows/actions/build/action.yml` to separate `image_name` and `image_tag` inputs instead of using `image_name_tag`. Updated `.github/workflows/ci.yml` to accommodate these changes across various build steps. This improves modularity and clarity in defining image names and tags for Docker builds.
1 parent 821609b commit 706735e

File tree

2 files changed

+68
-32
lines changed

2 files changed

+68
-32
lines changed

.github/workflows/actions/build/action.yml

+16-6
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ inputs:
88
description: 'Dockerfile'
99
required: true
1010
default: 'Dockerfile'
11-
image_name_tag:
12-
description: 'Image name:tag'
11+
image_name:
12+
description: 'Image name'
13+
required: true
14+
image_tag:
15+
description: 'Image tag'
1316
required: true
1417
username:
1518
description: 'Registry username'
@@ -51,18 +54,25 @@ runs:
5154
echo "hash=" >> "$GITHUB_ENV"
5255
shell: bash
5356

57+
- name: Make image name
58+
run: |
59+
IMAGE=hyperskill.azurecr.io/epicbox/${{ inputs.image_name }}
60+
echo "image_name=$IMAGE" >> "$GITHUB_ENV"
61+
echo "image_tag=$IMAGE:${{ inputs.image_tag }}${{ env.hash }}" >> "$GITHUB_ENV"
62+
shell: bash
63+
5464
- name: Build base
5565
uses: docker/build-push-action@v3
5666
with:
5767
context: ${{ inputs.path }}
5868
pull: true
5969
push: true
6070
file: ${{ inputs.path }}/${{ inputs.dockerfile }}
61-
tags: hyperskill.azurecr.io/epicbox/${{ inputs.image_name_tag }}${{ env.hash }}
62-
cache-from: type=gha
63-
cache-to: type=gha,mode=max
71+
tags: ${{ env.image_tag }}
72+
cache-to: type=registry,ref=${{ env.image_name }}:buildcache,mode=max
73+
cache-from: type=registry,ref=${{ env.image_name }}:buildcache
6474

6575
- name: Display image:tag in summary
6676
run: |
67-
echo "hyperskill.azurecr.io/epicbox/${{ inputs.image_name_tag }}${{ env.hash }}" >> $GITHUB_STEP_SUMMARY
77+
echo "${{ env.image_tag }}" >> $GITHUB_STEP_SUMMARY
6878
shell: bash

.github/workflows/ci.yml

+52-26
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ jobs:
2020
uses: ./.github/workflows/actions/build
2121
with:
2222
path: epicbox-debian
23-
image_name_tag: debian:bullseye
23+
image_name: debian
24+
image_tag: bullseye
2425
username: ${{ secrets.REGISTRY_USER }}
2526
password: ${{ secrets.REGISTRY_PASSWORD }}
2627
add_hash: false
@@ -34,7 +35,8 @@ jobs:
3435
uses: ./.github/workflows/actions/build
3536
with:
3637
path: epicbox-clojure
37-
image_name_tag: clojure:1.9.0.397
38+
image_name: clojure
39+
image_tag: 1.9.0.397
3840
username: ${{ secrets.REGISTRY_USER }}
3941
password: ${{ secrets.REGISTRY_PASSWORD }}
4042
build_gcc_image:
@@ -48,7 +50,8 @@ jobs:
4850
uses: ./.github/workflows/actions/build
4951
with:
5052
path: epicbox-gcc
51-
image_name_tag: gcc:10.2.1
53+
image_name: gcc
54+
image_tag: 10.2.1
5255
username: ${{ secrets.REGISTRY_USER }}
5356
password: ${{ secrets.REGISTRY_PASSWORD }}
5457
build_go_image:
@@ -61,7 +64,8 @@ jobs:
6164
uses: ./.github/workflows/actions/build
6265
with:
6366
path: epicbox-go
64-
image_name_tag: go:1.18.2.1
67+
image_name: go
68+
image_tag: 1.18.2.1
6569
username: ${{ secrets.REGISTRY_USER }}
6670
password: ${{ secrets.REGISTRY_PASSWORD }}
6771
build_haskell_image:
@@ -74,7 +78,8 @@ jobs:
7478
uses: ./.github/workflows/actions/build
7579
with:
7680
path: epicbox-haskell
77-
image_name_tag: haskell:8.8.4
81+
image_name: haskell
82+
image_tag: 8.8.4
7883
username: ${{ secrets.REGISTRY_USER }}
7984
password: ${{ secrets.REGISTRY_PASSWORD }}
8085
build_hyperskill_go_image:
@@ -87,7 +92,8 @@ jobs:
8792
uses: ./.github/workflows/actions/build
8893
with:
8994
path: epicbox-hyperskill/go
90-
image_name_tag: hyperskill-go:1.18.2
95+
image_name: hyperskill-go
96+
image_tag: 1.18.2
9197
username: ${{ secrets.REGISTRY_USER }}
9298
password: ${{ secrets.REGISTRY_PASSWORD }}
9399
build_hyperskill_gcc_image:
@@ -101,7 +107,8 @@ jobs:
101107
uses: ./.github/workflows/actions/build
102108
with:
103109
path: epicbox-hyperskill/gcc
104-
image_name_tag: hyperskill-gcc:10.2.1
110+
image_name: hyperskill-gcc
111+
image_tag: 10.2.1
105112
username: ${{ secrets.REGISTRY_USER }}
106113
password: ${{ secrets.REGISTRY_PASSWORD }}
107114
build_hyperskill_gradle_image:
@@ -114,7 +121,8 @@ jobs:
114121
uses: ./.github/workflows/actions/build
115122
with:
116123
path: epicbox-hyperskill/gradle
117-
image_name_tag: hyperskill-gradle:8.5-jdk17
124+
image_name: hyperskill-gradle
125+
image_tag: 8.5-jdk17
118126
username: ${{ secrets.REGISTRY_USER }}
119127
password: ${{ secrets.REGISTRY_PASSWORD }}
120128
build_hyperskill_gradle_spring_image:
@@ -127,7 +135,8 @@ jobs:
127135
uses: ./.github/workflows/actions/build
128136
with:
129137
path: epicbox-hyperskill/gradle-spring
130-
image_name_tag: hyperskill-gradle-spring:8.5-jdk17
138+
image_name: hyperskill-gradle-spring
139+
image_tag: 8.5-jdk17
131140
username: ${{ secrets.REGISTRY_USER }}
132141
password: ${{ secrets.REGISTRY_PASSWORD }}
133142
build_hyperskill_java_image:
@@ -140,7 +149,8 @@ jobs:
140149
uses: ./.github/workflows/actions/build
141150
with:
142151
path: epicbox-hyperskill/java
143-
image_name_tag: hyperskill-java:17
152+
image_name: hyperskill-java
153+
image_tag: 17
144154
username: ${{ secrets.REGISTRY_USER }}
145155
password: ${{ secrets.REGISTRY_PASSWORD }}
146156
build_hyperskill_node_image:
@@ -153,7 +163,8 @@ jobs:
153163
uses: ./.github/workflows/actions/build
154164
with:
155165
path: epicbox-hyperskill/node
156-
image_name_tag: hyperskill-node:18.17.1
166+
image_name: hyperskill-node
167+
image_tag: 18.17.1
157168
username: ${{ secrets.REGISTRY_USER }}
158169
password: ${{ secrets.REGISTRY_PASSWORD }}
159170
build_hyperskill_node_javascript_image:
@@ -166,7 +177,8 @@ jobs:
166177
uses: ./.github/workflows/actions/build
167178
with:
168179
path: epicbox-hyperskill/node-javascript
169-
image_name_tag: hyperskill-node-javascript:18.17.1
180+
image_name: hyperskill-node-javascript
181+
image_tag: 18.17.1
170182
username: ${{ secrets.REGISTRY_USER }}
171183
password: ${{ secrets.REGISTRY_PASSWORD }}
172184
build_hyperskill_python_image:
@@ -179,7 +191,8 @@ jobs:
179191
uses: ./.github/workflows/actions/build
180192
with:
181193
path: epicbox-hyperskill/python
182-
image_name_tag: hyperskill-python:3.10
194+
image_name: hyperskill-python
195+
image_tag: 3.10
183196
username: ${{ secrets.REGISTRY_USER }}
184197
password: ${{ secrets.REGISTRY_PASSWORD }}
185198
build_java_image:
@@ -192,7 +205,8 @@ jobs:
192205
uses: ./.github/workflows/actions/build
193206
with:
194207
path: epicbox-java
195-
image_name_tag: java:23-slim
208+
image_name: java
209+
image_tag: 23-slim
196210
username: ${{ secrets.REGISTRY_USER }}
197211
password: ${{ secrets.REGISTRY_PASSWORD }}
198212
build_kotlin_image:
@@ -205,7 +219,8 @@ jobs:
205219
uses: ./.github/workflows/actions/build
206220
with:
207221
path: epicbox-kotlin
208-
image_name_tag: kotlin:2.0.0
222+
image_name: kotlin
223+
image_tag: 2.0.0
209224
username: ${{ secrets.REGISTRY_USER }}
210225
password: ${{ secrets.REGISTRY_PASSWORD }}
211226
build_mono_image:
@@ -219,7 +234,8 @@ jobs:
219234
uses: ./.github/workflows/actions/build
220235
with:
221236
path: epicbox-mono
222-
image_name_tag: mono:6.10.0.104
237+
image_name: mono
238+
image_tag: 6.10.0.104
223239
username: ${{ secrets.REGISTRY_USER }}
224240
password: ${{ secrets.REGISTRY_PASSWORD }}
225241
build_node_image:
@@ -232,7 +248,8 @@ jobs:
232248
uses: ./.github/workflows/actions/build
233249
with:
234250
path: epicbox-node
235-
image_name_tag: node:18.17.1
251+
image_name: node
252+
image_tag: 18.17.1
236253
username: ${{ secrets.REGISTRY_USER }}
237254
password: ${{ secrets.REGISTRY_PASSWORD }}
238255
build_php_image:
@@ -245,7 +262,8 @@ jobs:
245262
uses: ./.github/workflows/actions/build
246263
with:
247264
path: epicbox-php
248-
image_name_tag: php:7.2.6
265+
image_name: php
266+
image_tag: 7.2.6
249267
username: ${{ secrets.REGISTRY_USER }}
250268
password: ${{ secrets.REGISTRY_PASSWORD }}
251269
build_pmd_image:
@@ -258,7 +276,8 @@ jobs:
258276
uses: ./.github/workflows/actions/build
259277
with:
260278
path: epicbox-pmd
261-
image_name_tag: pmd:6.9.0
279+
image_name: pmd
280+
image_tag: 6.9.0
262281
username: ${{ secrets.REGISTRY_USER }}
263282
password: ${{ secrets.REGISTRY_PASSWORD }}
264283
build_python_310_image:
@@ -271,7 +290,8 @@ jobs:
271290
uses: ./.github/workflows/actions/build
272291
with:
273292
path: epicbox-python/310
274-
image_name_tag: python:3.10.6
293+
image_name: python
294+
image_tag: 3.10.6
275295
username: ${{ secrets.REGISTRY_USER }}
276296
password: ${{ secrets.REGISTRY_PASSWORD }}
277297
build_python_311_image:
@@ -284,7 +304,8 @@ jobs:
284304
uses: ./.github/workflows/actions/build
285305
with:
286306
path: epicbox-python/311
287-
image_name_tag: python:3.11.5
307+
image_name: python
308+
image_tag: 3.11.5
288309
username: ${{ secrets.REGISTRY_USER }}
289310
password: ${{ secrets.REGISTRY_PASSWORD }}
290311
build_ruby_image:
@@ -297,7 +318,8 @@ jobs:
297318
uses: ./.github/workflows/actions/build
298319
with:
299320
path: epicbox-ruby
300-
image_name_tag: ruby:2.5.3
321+
image_name: ruby
322+
image_tag: 2.5.3
301323
username: ${{ secrets.REGISTRY_USER }}
302324
password: ${{ secrets.REGISTRY_PASSWORD }}
303325
build_scala2_image:
@@ -310,7 +332,8 @@ jobs:
310332
uses: ./.github/workflows/actions/build
311333
with:
312334
path: epicbox-scala/2
313-
image_name_tag: scala:2.13.12
335+
image_name: scala
336+
image_tag: 2.13.12
314337
username: ${{ secrets.REGISTRY_USER }}
315338
password: ${{ secrets.REGISTRY_PASSWORD }}
316339
build_scala3_image:
@@ -323,7 +346,8 @@ jobs:
323346
uses: ./.github/workflows/actions/build
324347
with:
325348
path: epicbox-scala/3
326-
image_name_tag: scala:3.0.0
349+
image_name: scala
350+
image_tag: 3.0.0
327351
username: ${{ secrets.REGISTRY_USER }}
328352
password: ${{ secrets.REGISTRY_PASSWORD }}
329353
build_typescript_image:
@@ -336,7 +360,8 @@ jobs:
336360
uses: ./.github/workflows/actions/build
337361
with:
338362
path: epicbox-typescript
339-
image_name_tag: typescript:4.8.4
363+
image_name: typescript
364+
image_tag: 4.8.4
340365
username: ${{ secrets.REGISTRY_USER }}
341366
password: ${{ secrets.REGISTRY_PASSWORD }}
342367
build_hyperstyle_image:
@@ -349,7 +374,8 @@ jobs:
349374
uses: ./.github/workflows/actions/build
350375
with:
351376
path: epicbox-hyperstyle
352-
image_name_tag: hyperstyle:ij-2024.9
377+
image_name: hyperstyle
378+
image_tag: ij-2024.9
353379
username: ${{ secrets.REGISTRY_USER }}
354380
password: ${{ secrets.REGISTRY_PASSWORD }}
355381

0 commit comments

Comments
 (0)