aarch64 sync & tar #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: aarch64 sync & tar | |
on: | |
workflow_dispatch: | |
inputs: | |
docker_images: | |
description: '请填写docker镜像名称, 多个用英文逗号分开' | |
required: true | |
default: 'nginx:1.25.5,openeuler/openeuler:24.03-lts' # 设置默认的 Docker 镜像列表 | |
env: | |
HUAWEICLOUD_IAM_AK: "${{ secrets.HUAWEICLOUD_IAM_AK }}" | |
HUAWEICLOUD_IAM_SK: "${{ secrets.HUAWEICLOUD_IAM_SK }}" | |
jobs: | |
build: | |
name: aarch64 sync & tar | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v4 | |
- name: DockerHub to SWR | |
run: | | |
docker login -u cn-south-1@$HUAWEICLOUD_IAM_AK -p $HUAWEICLOUD_IAM_SK swr.cn-south-1.myhuaweicloud.com | |
set -ex | |
images="${{ github.event.inputs.docker_images }}" | |
IFS=',' read -r -a image_array <<< "$images" | |
for image in "${image_array[@]}"; do | |
docker pull "${image}" --platform "linux/arm64" | |
docker tag "${image}" swr.cn-south-1.myhuaweicloud.com/gsc-hub/${image}-aarch64 | |
docker push swr.cn-south-1.myhuaweicloud.com/gsc-hub/${image}-aarch64 | |
docker save "${image}" -o "${image//\//_}-aarch64.tar" | |
done | |
- name: Compress the TAR files | |
run: tar -czf aarch64-images.tar.gz *-aarch64.tar | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: aarch64-images.tar.gz | |
path: aarch64-images.tar.gz | |
retention-days: 1 # 将保留天数设置为1天 最多可设置90天 | |
- name: Clean up intermediate files | |
run: | | |
rm *-aarch64.tar |