1
+ # Copyright (c) 2022 Institute of Software Chinese Academy of Sciences (ISCAS)
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
name : container build and push
2
16
3
17
on :
9
23
10
24
env :
11
25
REGISTRY : ghcr.io
12
- EULIX_REGISTRY : ${{ secrets.EULIX_REGISTRY }}
26
+ EULIX_REGISTRY : hub.eulix.xyz
27
+ HUAWEICLOUD_REGISTRY_SH : swr.cn-east-3.myhuaweicloud.com
28
+ HUAWEICLOUD_REGISTRY_BJ : swr.cn-north-4.myhuaweicloud.com
29
+ HUAWEICLOUD_REGISTRY_GZ : swr.cn-south-1.myhuaweicloud.com
30
+ HUAWEICLOUD_REGISTRY_HK : swr.ap-southeast-1.myhuaweicloud.com
31
+ HUAWEICLOUD_REGISTRY_SG : swr.ap-southeast-3.myhuaweicloud.com
32
+ HUAWEICLOUD_REGISTRY_AF : swr.af-south-1.myhuaweicloud.com
33
+ HUAWEICLOUD_REGISTRY_LA : swr.la-north-2.myhuaweicloud.com
13
34
IMAGE_NAME : ${{ github.repository }}
14
35
15
36
jobs :
16
37
17
38
build :
18
- runs-on : [self-hosted, linux, x64]
39
+ runs-on : ubuntu-latest
19
40
permissions :
20
41
contents : read
21
42
packages : write
32
53
- name : Setup Docker buildx
33
54
uses : docker/setup-buildx-action@v2
34
55
56
+ - run : echo "GITHUB_REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
57
+ shell : bash
58
+
35
59
- name : Inspect builder
36
60
run : |
37
61
echo "Name: ${{ steps.buildx.outputs.name }}"
@@ -56,17 +80,88 @@ jobs:
56
80
username : ${{ secrets.EULIX_REGISTRY_USERNAME }}
57
81
password : ${{ secrets.EULIX_REGISTRY_PASSWORD }}
58
82
83
+ - name : Log into registry Docker Hub
84
+ if : github.event_name != 'pull_request'
85
+ uses : docker/login-action@v2
86
+ with :
87
+ username : ${{ secrets.DOCKER_HUB_REGISTRY_USERNAME }}
88
+ password : ${{ secrets.DOCKER_HUB_REGISTRY_PASSWORD }}
89
+
90
+ - name : Log into registry ${{ env.HUAWEICLOUD_REGISTRY_SH }}
91
+ if : github.event_name != 'pull_request'
92
+ uses : docker/login-action@v2
93
+ with :
94
+ registry : ${{ env.HUAWEICLOUD_REGISTRY_SH }}
95
+ username : cn-east-3@${{ secrets.HUAWEICLOUD_USERNAME }}
96
+ password : ${{ secrets.HUAWEICLOUD_PASSWORD }}
97
+
98
+ - name : Log into registry ${{ env.HUAWEICLOUD_REGISTRY_BJ }}
99
+ if : github.event_name != 'pull_request'
100
+ uses : docker/login-action@v2
101
+ with :
102
+ registry : ${{ env.HUAWEICLOUD_REGISTRY_BJ }}
103
+ username : cn-north-4@${{ secrets.HUAWEICLOUD_USERNAME }}
104
+ password : ${{ secrets.HUAWEICLOUD_PASSWORD }}
105
+
106
+ - name : Log into registry ${{ env.HUAWEICLOUD_REGISTRY_GZ }}
107
+ if : github.event_name != 'pull_request'
108
+ uses : docker/login-action@v2
109
+ with :
110
+ registry : ${{ env.HUAWEICLOUD_REGISTRY_GZ }}
111
+ username : cn-south-1@${{ secrets.HUAWEICLOUD_USERNAME }}
112
+ password : ${{ secrets.HUAWEICLOUD_PASSWORD }}
113
+
114
+ - name : Log into registry ${{ env.HUAWEICLOUD_REGISTRY_SG }}
115
+ if : github.event_name != 'pull_request'
116
+ uses : docker/login-action@v2
117
+ with :
118
+ registry : ${{ env.HUAWEICLOUD_REGISTRY_SG }}
119
+ username : ap-southeast-3@${{ secrets.HUAWEICLOUD_USERNAME }}
120
+ password : ${{ secrets.HUAWEICLOUD_PASSWORD }}
121
+
122
+ - name : Log into registry ${{ env.HUAWEICLOUD_REGISTRY_HK }}
123
+ if : github.event_name != 'pull_request'
124
+ uses : docker/login-action@v2
125
+ with :
126
+ registry : ${{ env.HUAWEICLOUD_REGISTRY_HK }}
127
+ username : ap-southeast-1@${{ secrets.HUAWEICLOUD_USERNAME }}
128
+ password : ${{ secrets.HUAWEICLOUD_PASSWORD }}
129
+
130
+ - name : Log into registry ${{ env.HUAWEICLOUD_REGISTRY_AF }}
131
+ if : github.event_name != 'pull_request'
132
+ uses : docker/login-action@v2
133
+ with :
134
+ registry : ${{ env.HUAWEICLOUD_REGISTRY_AF }}
135
+ username : af-south-1@${{ secrets.HUAWEICLOUD_USERNAME }}
136
+ password : ${{ secrets.HUAWEICLOUD_PASSWORD }}
137
+
138
+ - name : Log into registry ${{ env.HUAWEICLOUD_REGISTRY_LA }}
139
+ if : github.event_name != 'pull_request'
140
+ uses : docker/login-action@v2
141
+ with :
142
+ registry : ${{ env.HUAWEICLOUD_REGISTRY_LA }}
143
+ username : la-north-2@${{ secrets.HUAWEICLOUD_USERNAME }}
144
+ password : ${{ secrets.HUAWEICLOUD_PASSWORD }}
145
+
59
146
- name : Extract Docker metadata
60
147
id : meta
61
148
uses : docker/metadata-action@v2
62
149
with :
63
150
images : |
64
151
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
65
152
${{ env.EULIX_REGISTRY }}/${{ env.IMAGE_NAME }}
153
+ aospace/${{ env.GITHUB_REPOSITORY_NAME }}
154
+ ${{ env.HUAWEICLOUD_REGISTRY_SH }}/${{ env.IMAGE_NAME }}
155
+ ${{ env.HUAWEICLOUD_REGISTRY_BJ }}/${{ env.IMAGE_NAME }}
156
+ ${{ env.HUAWEICLOUD_REGISTRY_GZ }}/${{ env.IMAGE_NAME }}
157
+ ${{ env.HUAWEICLOUD_REGISTRY_HK }}/${{ env.IMAGE_NAME }}
158
+ ${{ env.HUAWEICLOUD_REGISTRY_SG }}/${{ env.IMAGE_NAME }}
159
+ ${{ env.HUAWEICLOUD_REGISTRY_AF }}/${{ env.IMAGE_NAME }}
160
+ ${{ env.HUAWEICLOUD_REGISTRY_LA }}/${{ env.IMAGE_NAME }}
66
161
67
162
- name : Build and push Docker image
68
163
id : build-and-push
69
- uses : docker/build-push-action@v2
164
+ uses : docker/build-push-action@v4.2.1
70
165
with :
71
166
context : .
72
167
push : ${{ github.event_name != 'pull_request' }}
76
171
platforms : linux/amd64,linux/arm64
77
172
cache-from : type=gha
78
173
cache-to : type=gha,mode=max
79
- file : Dockerfile
174
+ file : Dockerfile
175
+ provenance : false
0 commit comments