wwt164888 is Sync Images to DockerHub. #7
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: 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 |