Merge pull request #19 from suyar/dependabot/docker_compose/dependabo… #6
This file contains hidden or 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 Drone Server | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '.github/workflows/sync-drone-server.yml' | |
| concurrency: | |
| group: sync-drone-server-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| max-parallel: 2 | |
| matrix: | |
| version: | |
| - "2" | |
| - "2.28.2" | |
| steps: | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4.0.0 | |
| - name: Login to Aliyun | |
| uses: docker/login-action@v4.1.0 | |
| with: | |
| registry: ${{ secrets.ALI_DOCKER_REPO }} | |
| username: ${{ secrets.ALI_DOCKER_USER }} | |
| password: ${{ secrets.ALI_DOCKER_PASS }} | |
| - name: Copy drone/drone:${{ matrix.version }} (buildx imagetools) | |
| env: | |
| SRC: ${{ secrets.DOCKERHUB_MIRROR }}/drone/drone:${{ matrix.version }} | |
| DST: ${{ secrets.ALI_DOCKER_REPO }}/mirrors_hub/drone_server:${{ matrix.version }} | |
| run: | | |
| SRC_DIGEST="$(docker buildx imagetools inspect "$SRC" | awk '/^Digest:/ {print $2; exit}')" | |
| DST_DIGEST="$(docker buildx imagetools inspect "$DST" 2>/dev/null | awk '/^Digest:/ {print $2; exit}' || true)" | |
| if [ -z "$SRC_DIGEST" ]; then | |
| echo "Failed to resolve source digest: $SRC" | |
| exit 1 | |
| fi | |
| if [ -n "$DST_DIGEST" ] && [ "$SRC_DIGEST" = "$DST_DIGEST" ]; then | |
| echo "Digest unchanged ($SRC_DIGEST), skip sync." | |
| exit 0 | |
| fi | |
| docker buildx imagetools create --tag "$DST" "$SRC" |