-
Notifications
You must be signed in to change notification settings - Fork 3
45 lines (35 loc) · 1.16 KB
/
sync-images.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 工作流名称
name: Sync-Images
# 工作流运行时显示名称
run-name: ${{ github.actor }} is Sync Images to DockerHub.
# 触发工作流
on:
push:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# 工作流程任务
jobs:
syncimages:
runs-on: ubuntu-latest
steps:
- name: Checkout Repos
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to Docker Hub
uses: docker/[email protected]
with:
registry: ${{ secrets.ALIYUN_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
logout: false
- name: Use Skopeo Tools Sync Image
run: |
while read -r line; do
if [[ -z "$line" || "$line" == \#* ]]; then
continue
fi
image=$(echo $line |awk -F '/' '{print $NF}')
skopeo copy docker://${line} docker://${{ secrets.ALIYUN_REGISTRY }}/${{ secrets.ALIYUN_NAMESPACE }}/${image}
done < docker-images.txt