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+
115name : container build and push
216
317on :
923
1024env :
1125 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
1334 IMAGE_NAME : ${{ github.repository }}
1435
1536jobs :
1637
1738 build :
18- runs-on : [self-hosted, linux, x64]
39+ runs-on : ubuntu-latest
1940 permissions :
2041 contents : read
2142 packages : write
3253 - name : Setup Docker buildx
3354 uses : docker/setup-buildx-action@v2
3455
56+ - run : echo "GITHUB_REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
57+ shell : bash
58+
3559 - name : Inspect builder
3660 run : |
3761 echo "Name: ${{ steps.buildx.outputs.name }}"
@@ -56,17 +80,88 @@ jobs:
5680 username : ${{ secrets.EULIX_REGISTRY_USERNAME }}
5781 password : ${{ secrets.EULIX_REGISTRY_PASSWORD }}
5882
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+
59146 - name : Extract Docker metadata
60147 id : meta
61148 uses : docker/metadata-action@v2
62149 with :
63150 images : |
64151 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
65152 ${{ 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 }}
66161
67162 - name : Build and push Docker image
68163 id : build-and-push
69- uses : docker/build-push-action@v2
164+ uses : docker/build-push-action@v4.2.1
70165 with :
71166 context : .
72167 push : ${{ github.event_name != 'pull_request' }}
76171 platforms : linux/amd64,linux/arm64
77172 cache-from : type=gha
78173 cache-to : type=gha,mode=max
79- file : Dockerfile
174+ file : Dockerfile
175+ provenance : false
0 commit comments