# This is a basic workflow to help you get started with Actions
name:SyncDokcerImageToAliyunRepo
# Controls when the action will run. on: # Triggers the workflow on push or pull request events but only for the master branch # push: # branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: sync-task: # The type of runner that the job will run on runs-on:ubuntu-latest strategy: fail-fast:false matrix: include: -source_docker_image:mattermost/mattermost-enterprise-edition:7.5.0 target_docker_image:mattermost-enterprise-edition:7.5.0 -source_docker_image:nginx:latest target_docker_image:nginx:latest
# Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it -uses:actions/checkout@v2
# Runs a set of commands using the runners shell portainer/agent
jobs: sync-task: # The type of runner that the job will run on runs-on:ubuntu-latest strategy: fail-fast:false matrix: #接收Api的参数 images:'${{ github.event.client_payload.images }}'
# Steps represent a sequence of tasks that will be executed as part of the job steps: -uses:actions/checkout@v2 -name:sync${{matrix.images.source}} run:| docker pull $source_docker_image docker tag $source_docker_image $target_docker_image docker login --username=${{secrets.DOCKER_USERNAME}} --password=${{secrets.DOCKER_PASSWORD}} ${{secrets.DOCKER_REGISTRY}} docker push $target_docker_image env: source_docker_image:${{matrix.images.source}} target_docker_image:${{secrets.DOCKER_REGISTRY}}/${{secrets.DOCKER_NAMESPACE}}/${{matrix.images.target}}