11
11
- " 06-demo-application/**/*"
12
12
13
13
jobs :
14
+ generate-image-tag :
15
+ runs-on : ubuntu-latest
16
+ outputs :
17
+ image_tag : ${{ steps.generate-image-tag.outputs.image_tag }}
18
+ steps :
19
+ - name : Checkout
20
+ uses : actions/checkout@v4
21
+ with :
22
+ # Necessary to get all tags for IMAGE_TAG generation with git describe
23
+ fetch-depth : 0
24
+
25
+ - name : Install Task
26
+ uses : arduino/setup-task@v2
27
+ with :
28
+ version : 3.x
29
+
30
+ - name : Generate Image Tag
31
+ id : generate-image-tag
32
+ working-directory : 14-cicd/github-actions
33
+ run : |
34
+ image_tag=$(task generate-version-tag)
35
+ echo "image_tag=$image_tag" >> $GITHUB_OUTPUT
36
+
14
37
build-tag-push :
15
38
runs-on : ubuntu-latest
39
+ needs : generate-image-tag
16
40
strategy :
17
41
matrix :
18
42
path :
25
49
steps :
26
50
- name : Checkout
27
51
uses : actions/checkout@v4
28
- with :
29
- # Necessary to get all tags for IMAGE_TAG generation with git describe
30
- fetch-depth : 0
31
52
32
53
- name : Install Task
33
54
uses : arduino/setup-task@v2
@@ -65,39 +86,28 @@ jobs:
65
86
66
87
- name : Build Image
67
88
env :
68
- IMAGE_TAG : ${{ steps .generate-image-tag.outputs.image_tag }}
89
+ IMAGE_TAG : ${{ needs .generate-image-tag.outputs.image_tag }}
69
90
working-directory : ${{ matrix.path }}
70
91
run : |
71
92
task build-container-image-multi-arch IMAGE_TAG=${IMAGE_TAG}
72
93
73
94
update-tags :
74
95
runs-on : ubuntu-latest
75
- needs : build-tag-push
96
+ needs : [generate-image-tag, build-tag-push]
76
97
77
98
steps :
78
99
- name : Checkout
79
100
uses : actions/checkout@v4
80
- with :
81
- # Necessary to get all tags for IMAGE_TAG generation with git describe
82
- fetch-depth : 0
83
101
84
102
- name : Install Task
85
103
uses : arduino/setup-task@v2
86
104
with :
87
105
version : 3.x
88
106
89
- # TODO: generate once and use everywhere (to avoid race condition)
90
- - name : Generate Image Tag
91
- id : generate-image-tag
92
- working-directory : 14-cicd/github-actions
93
- run : |
94
- image_tag=$(task generate-version-tag)
95
- echo "image_tag=$image_tag" >> $GITHUB_OUTPUT
96
-
97
107
- name : Update Image Tags
98
108
working-directory : 14-cicd/github-actions
99
109
env :
100
- IMAGE_TAG : ${{ steps .generate-image-tag.outputs.image_tag }}
110
+ IMAGE_TAG : ${{ needs .generate-image-tag.outputs.image_tag }}
101
111
run : |
102
112
# Update staging tags for push to main or release tag
103
113
task update-staging-image-tags NEW_TAG=${IMAGE_TAG}
@@ -112,4 +122,4 @@ jobs:
112
122
with :
113
123
base : main
114
124
token : ${{ secrets.DEVOPS_DIRECTIVE_KUBERNETES_COURSE_GITHUB_ACTION_PAT }}
115
- title : " Update image tags to (${{ steps .generate-image-tag.outputs.image_tag }})"
125
+ title : " Update image tags to (${{ needs .generate-image-tag.outputs.image_tag }})"
0 commit comments