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 Docker Hub Images to Aliyun and Huawei Cloud | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install skopeo | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y skopeo | |
sudo apt-get install -y python3-pip | |
pip3 install pyyaml | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Login to Docker Hub | |
uses: docker/[email protected] | |
with: | |
registry: docker.io | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to Aliyun Container Registry | |
uses: docker/[email protected] | |
with: | |
registry: registry.cn-hangzhou.aliyuncs.com | |
username: ${{ secrets.ALIYUM_DOCKER_USERNAME }} | |
password: ${{ secrets.ALIYUM_DOCKER_PASSWORD }} | |
- name: Login to Huawei Cloud Container Registry | |
uses: docker/[email protected] | |
with: | |
registry: swr.cn-southwest-2.myhuaweicloud.com | |
username: ${{ secrets.HWYUM_DOCKER_USERNAME }} | |
password: ${{ secrets.HWYUM_DOCKER_PASSWORD }} | |
# - name: Sync images | |
# run: | | |
# python3 sync_images.py | |
- name: Sync images | |
run: | | |
chmod +x sync.sh | |
./sync.sh "${{ secrets.ALIYUM_DOCKER_USERNAME }}" "${{ secrets.ALIYUM_DOCKER_PASSWORD }}" |