4
4
push :
5
5
tags :
6
6
- v*
7
+ workflow_dispatch :
8
+ inputs :
9
+ antrea-tag :
10
+ description : The Antrea tag (e.g. v2.3.0) for which images should be built.
11
+ type : string
12
+ required : true
7
13
8
14
jobs :
9
15
get-version :
10
16
runs-on : [ubuntu-latest]
11
17
outputs :
12
18
version : ${{ steps.get-version.outputs.version }}
19
+ antrea_ref : ${{ steps.get-version.outputs.antrea_ref }}
13
20
steps :
14
21
- name : Extract version from Github ref
15
22
id : get-version
16
- env :
17
- TAG : ${{ github.ref }}
18
23
run : |
19
- version=${TAG:10}
24
+ version=${{ inputs.antrea-tag }}
25
+ if [ -z "$version" ]; then
26
+ tag=${{ github.ref }}
27
+ version=${tag:10}
28
+ fi
20
29
echo "version=$version" >> $GITHUB_OUTPUT
30
+ echo "antrea_ref=refs/tags/$version" >> $GITHUB_OUTPUT
21
31
22
32
build :
23
33
needs : get-version
39
49
steps :
40
50
- uses : actions/checkout@v4
41
51
with :
52
+ ref : ${{ needs.get-version.outputs.antrea_ref }}
42
53
show-progress : false
43
54
- name : Set up Docker Buildx
44
55
uses : docker/setup-buildx-action@v3
@@ -50,13 +61,11 @@ jobs:
50
61
run : |
51
62
./hack/build-antrea-linux-all.sh --platform ${{ matrix.platform }} --pull
52
63
- name : Login to Docker Hub
53
- if : ${{ needs.check-env.outputs.push_needed == 'true' }}
54
64
uses : docker/login-action@v3
55
65
with :
56
66
username : ${{ secrets.DOCKER_USERNAME }}
57
67
password : ${{ secrets.DOCKER_PASSWORD }}
58
68
- name : Login to Github Container Registry
59
- if : ${{ needs.check-env.outputs.push_needed == 'true' }}
60
69
uses : docker/login-action@v3
61
70
with :
62
71
registry : ghcr.io
@@ -100,13 +109,13 @@ jobs:
100
109
- name : Set up Docker Buildx
101
110
uses : docker/setup-buildx-action@v3
102
111
- name : Login to Docker Hub
103
- if : ${{ needs.check-env.outputs.push_needed == 'true' && matrix.registry == 'docker.io' }}
112
+ if : ${{ matrix.registry == 'docker.io' }}
104
113
uses : docker/login-action@v3
105
114
with :
106
115
username : ${{ secrets.DOCKER_USERNAME }}
107
116
password : ${{ secrets.DOCKER_PASSWORD }}
108
117
- name : Login to Github Container Registry
109
- if : ${{ needs.check-env.outputs.push_needed == 'true' && matrix.registry == 'ghcr.io' }}
118
+ if : ${{ matrix.registry == 'ghcr.io' }}
110
119
uses : docker/login-action@v3
111
120
with :
112
121
registry : ghcr.io
@@ -133,6 +142,7 @@ jobs:
133
142
steps :
134
143
- uses : actions/checkout@v4
135
144
with :
145
+ ref : ${{ needs.get-version.outputs.antrea_ref }}
136
146
show-progress : false
137
147
- name : Set up Docker Buildx
138
148
uses : docker/setup-buildx-action@v3
@@ -153,6 +163,7 @@ jobs:
153
163
steps :
154
164
- uses : actions/checkout@v4
155
165
with :
166
+ ref : ${{ needs.get-version.outputs.antrea_ref }}
156
167
show-progress : false
157
168
- name : Build Antrea Windows Docker image and push to registry
158
169
env :
@@ -170,6 +181,7 @@ jobs:
170
181
steps :
171
182
- uses : actions/checkout@v4
172
183
with :
184
+ ref : ${{ needs.get-version.outputs.antrea_ref }}
173
185
show-progress : false
174
186
- name : Build antrea-mc-controller Docker image and push to registry
175
187
env :
@@ -187,6 +199,7 @@ jobs:
187
199
steps :
188
200
- uses : actions/checkout@v4
189
201
with :
202
+ ref : ${{ needs.get-version.outputs.antrea_ref }}
190
203
show-progress : false
191
204
- name : Build flow-aggregator Docker image and push to registry
192
205
env :
0 commit comments