Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.0.1 #2

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 100 additions & 4 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright (c) 2022 Institute of Software Chinese Academy of Sciences (ISCAS)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: container build and push

on:
Expand All @@ -9,13 +23,20 @@ on:

env:
REGISTRY: ghcr.io
EULIX_REGISTRY: ${{ secrets.EULIX_REGISTRY }}
EULIX_REGISTRY: hub.eulix.xyz
HUAWEICLOUD_REGISTRY_SH: swr.cn-east-3.myhuaweicloud.com
HUAWEICLOUD_REGISTRY_BJ: swr.cn-north-4.myhuaweicloud.com
HUAWEICLOUD_REGISTRY_GZ: swr.cn-south-1.myhuaweicloud.com
HUAWEICLOUD_REGISTRY_HK: swr.ap-southeast-1.myhuaweicloud.com
HUAWEICLOUD_REGISTRY_SG: swr.ap-southeast-3.myhuaweicloud.com
HUAWEICLOUD_REGISTRY_AF: swr.af-south-1.myhuaweicloud.com
HUAWEICLOUD_REGISTRY_LA: swr.la-north-2.myhuaweicloud.com
IMAGE_NAME: ${{ github.repository }}

jobs:

build:
runs-on: [self-hosted, linux, x64]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
Expand All @@ -32,6 +53,9 @@ jobs:
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

- run: echo "GITHUB_REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
shell: bash

- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
Expand All @@ -56,17 +80,88 @@ jobs:
username: ${{ secrets.EULIX_REGISTRY_USERNAME }}
password: ${{ secrets.EULIX_REGISTRY_PASSWORD }}

- name: Log into registry Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_HUB_REGISTRY_PASSWORD }}

- name: Log into registry ${{ env.HUAWEICLOUD_REGISTRY_SH }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.HUAWEICLOUD_REGISTRY_SH }}
username: cn-east-3@${{ secrets.HUAWEICLOUD_USERNAME }}
password: ${{ secrets.HUAWEICLOUD_PASSWORD }}

- name: Log into registry ${{ env.HUAWEICLOUD_REGISTRY_BJ }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.HUAWEICLOUD_REGISTRY_BJ }}
username: cn-north-4@${{ secrets.HUAWEICLOUD_USERNAME }}
password: ${{ secrets.HUAWEICLOUD_PASSWORD }}

- name: Log into registry ${{ env.HUAWEICLOUD_REGISTRY_GZ }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.HUAWEICLOUD_REGISTRY_GZ }}
username: cn-south-1@${{ secrets.HUAWEICLOUD_USERNAME }}
password: ${{ secrets.HUAWEICLOUD_PASSWORD }}

- name: Log into registry ${{ env.HUAWEICLOUD_REGISTRY_SG }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.HUAWEICLOUD_REGISTRY_SG }}
username: ap-southeast-3@${{ secrets.HUAWEICLOUD_USERNAME }}
password: ${{ secrets.HUAWEICLOUD_PASSWORD }}

- name: Log into registry ${{ env.HUAWEICLOUD_REGISTRY_HK }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.HUAWEICLOUD_REGISTRY_HK }}
username: ap-southeast-1@${{ secrets.HUAWEICLOUD_USERNAME }}
password: ${{ secrets.HUAWEICLOUD_PASSWORD }}

- name: Log into registry ${{ env.HUAWEICLOUD_REGISTRY_AF }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.HUAWEICLOUD_REGISTRY_AF }}
username: af-south-1@${{ secrets.HUAWEICLOUD_USERNAME }}
password: ${{ secrets.HUAWEICLOUD_PASSWORD }}

- name: Log into registry ${{ env.HUAWEICLOUD_REGISTRY_LA }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.HUAWEICLOUD_REGISTRY_LA }}
username: la-north-2@${{ secrets.HUAWEICLOUD_USERNAME }}
password: ${{ secrets.HUAWEICLOUD_PASSWORD }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v2
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
${{ env.EULIX_REGISTRY }}/${{ env.IMAGE_NAME }}
aospace/${{ env.GITHUB_REPOSITORY_NAME }}
${{ env.HUAWEICLOUD_REGISTRY_SH }}/${{ env.IMAGE_NAME }}
${{ env.HUAWEICLOUD_REGISTRY_BJ }}/${{ env.IMAGE_NAME }}
${{ env.HUAWEICLOUD_REGISTRY_GZ }}/${{ env.IMAGE_NAME }}
${{ env.HUAWEICLOUD_REGISTRY_HK }}/${{ env.IMAGE_NAME }}
${{ env.HUAWEICLOUD_REGISTRY_SG }}/${{ env.IMAGE_NAME }}
${{ env.HUAWEICLOUD_REGISTRY_AF }}/${{ env.IMAGE_NAME }}
${{ env.HUAWEICLOUD_REGISTRY_LA }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4.2.1
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
Expand All @@ -76,4 +171,5 @@ jobs:
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
file: Dockerfile
file: Dockerfile
provenance: false
Loading