@@ -28,62 +28,27 @@ jobs:
2828 uses : docker/setup-buildx-action@v3
2929 with :
3030 buildkitd-flags : --debug
31- - name : Cache Docker layers
32- uses : actions/cache@v4
33- with :
34- path : /tmp/.buildx-cache
35- key : ${{ runner.os }}-buildx-${{ matrix.platform }}-${{ matrix.variant.type }}-${{ github.sha }}
36- restore-keys : |
37- ${{ runner.os }}-buildx-${{ matrix.platform }}-${{ matrix.variant.type }}-
38-
39- - name : Prepare Docker build
40- id : prepare
41- run : |
42- REPO="bitcoin/bitcoin"
43- BRANCH="master"
44- PUSH="false"
45- if [[ "${{ github.event_name }}" == "schedule" ]]; then
46- PUSH="true"
47- fi
48-
49- echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" | tee -a $GITHUB_OUTPUT
50- echo "docker_platforms=${{ matrix.platform }}" | tee -a $GITHUB_OUTPUT
51- echo "docker_username=bitcoin" | tee -a $GITHUB_OUTPUT
52- echo "push=${PUSH}" | tee -a $GITHUB_OUTPUT
53- echo "tags=${REPO}:master${{ matrix.variant.type }}" | tee -a $GITHUB_OUTPUT
5431
5532 - name : Login into Docker Hub
5633 uses : docker/login-action@v3
5734 with :
58- username : ${{ steps.prepare.outputs.docker_username }}
35+ username : bitcoin
5936 password : ${{ secrets.DOCKER_HUB_PASSWORD }}
6037
6138 - name : ccache
6239 uses :
hendrikmuhs/[email protected] 6340 with :
6441 create-symlink : true
6542
66- - name : Build Docker image
67- run : |
68- TAGS=(${{ steps.prepare.outputs.tags }})
69-
70- echo "Build date: ${{ steps.prepare.outputs.build_date }}"
71- echo "Docker platform: ${{ steps.prepare.outputs.docker_platforms }}"
72- echo "Push: ${{ steps.prepare.outputs.push }}"
73- echo "Tags: ${{ steps.prepare.outputs.tags }}"
74-
75- docker buildx build --platform ${{ steps.prepare.outputs.docker_platforms }} \
76- --output "type=image,push=${{ steps.prepare.outputs.push }}" \
77- --progress=plain \
78- --cache-from "type=local,src=/tmp/.buildx-cache" \
79- --cache-to "type=local,dest=/tmp/.buildx-cache-new,mode=max" \
80- --build-arg "BUILD_DATE=${{ steps.prepare.outputs.build_date }}" \
81- --build-arg "VCS_REF=${GITHUB_SHA::8}" \
82- $(printf "%s" "${TAGS[@]/#/ --tag }" ) \
83- master${{ matrix.variant.suffix }}
84-
85- # Temp fix
86- # https://github.com/docker/build-push-action/issues/252
87- # https://github.com/moby/buildkit/issues/1896
88- rm -rf /tmp/.buildx-cache
89- mv /tmp/.buildx-cache-new /tmp/.buildx-cache
43+ - name : Build and push Docker image
44+ uses : docker/build-push-action@v6
45+ with :
46+ context : master${{ matrix.variant.suffix }}
47+ platforms : ${{ matrix.platform }}
48+ push : ${{ github.event_name == 'schedule' }}
49+ tags : bitcoin/bitcoin:master${{ matrix.variant.type }}
50+ cache-from : type=gha
51+ cache-to : type=gha,mode=max
52+ build-args : |
53+ BUILD_DATE=${{ github.event.repository.updated_at }}
54+ VCS_REF=${{ github.sha }}
0 commit comments