|
| 1 | +name: alpine-nightly-master |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 0 * * *" |
| 6 | + |
| 7 | +env: |
| 8 | + REGISTRY_IMAGE: bitcoin/bitcoin |
| 9 | + TAGS: master-alpine |
| 10 | + CONTEXT: master/alpine |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + runs-on: ${{ matrix.platform.github }} |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + platform: |
| 18 | + - github: ubuntu-24.04 |
| 19 | + docker: linux/amd64 |
| 20 | + - github: ubuntu-24.04-arm |
| 21 | + docker: linux/arm64 |
| 22 | + steps: |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Set up Docker Buildx |
| 27 | + uses: docker/setup-buildx-action@v3 |
| 28 | + |
| 29 | + - name: Prepare |
| 30 | + run: | |
| 31 | + platform=${{ matrix.platform.docker }} |
| 32 | + echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV |
| 33 | +
|
| 34 | + - name: Docker meta |
| 35 | + id: meta |
| 36 | + uses: docker/metadata-action@v5 |
| 37 | + with: |
| 38 | + images: ${{ env.REGISTRY_IMAGE }} |
| 39 | + tags: type=raw,value=${{ env.TAGS }} |
| 40 | + |
| 41 | + - name: Login into Docker Hub |
| 42 | + uses: docker/login-action@v3 |
| 43 | + with: |
| 44 | + username: bitcoin |
| 45 | + password: ${{ secrets.DOCKER_HUB_PASSWORD }} |
| 46 | + |
| 47 | + - name: ccache |
| 48 | + uses: hendrikmuhs/[email protected] |
| 49 | + with: |
| 50 | + create-symlink: true |
| 51 | + |
| 52 | + - name: Build and push Docker image |
| 53 | + id: build |
| 54 | + uses: docker/build-push-action@v6 |
| 55 | + with: |
| 56 | + context: ${{ env.CONTEXT }} |
| 57 | + platforms: ${{ matrix.platform.docker }} |
| 58 | + push: ${{ github.event_name == 'schedule' }} |
| 59 | + labels: ${{ steps.meta.outputs.labels }} |
| 60 | + tags: ${{ env.REGISTRY_IMAGE }} |
| 61 | + cache-from: type=gha |
| 62 | + cache-to: type=gha,mode=max |
| 63 | + build-args: | |
| 64 | + BUILD_DATE=${{ github.event.repository.updated_at }} |
| 65 | + VCS_REF=${{ github.sha }} |
| 66 | + outputs: type=image,push-by-digest=true,name-canonical=true |
| 67 | + |
| 68 | + - name: Export digest |
| 69 | + run: | |
| 70 | + mkdir -p ${{ runner.temp }}/digests |
| 71 | + digest="${{ steps.build.outputs.digest }}" |
| 72 | + touch "${{ runner.temp }}/digests/${digest#sha256:}" |
| 73 | +
|
| 74 | + - name: Upload digest |
| 75 | + uses: actions/upload-artifact@v4 |
| 76 | + with: |
| 77 | + name: digests-${{ env.PLATFORM_PAIR }} |
| 78 | + path: ${{ runner.temp }}/digests/* |
| 79 | + if-no-files-found: error |
| 80 | + retention-days: 1 |
| 81 | + merge: |
| 82 | + runs-on: ubuntu-latest |
| 83 | + needs: |
| 84 | + - build |
| 85 | + steps: |
| 86 | + - name: Download digests |
| 87 | + uses: actions/download-artifact@v4 |
| 88 | + with: |
| 89 | + path: ${{ runner.temp }}/digests |
| 90 | + pattern: digests-* |
| 91 | + merge-multiple: true |
| 92 | + |
| 93 | + - name: Login to Docker Hub |
| 94 | + uses: docker/login-action@v3 |
| 95 | + with: |
| 96 | + username: bitcoin |
| 97 | + password: ${{ secrets.DOCKER_HUB_PASSWORD }} |
| 98 | + |
| 99 | + - name: Set up Docker Buildx |
| 100 | + uses: docker/setup-buildx-action@v3 |
| 101 | + |
| 102 | + - name: Docker meta |
| 103 | + id: meta |
| 104 | + uses: docker/metadata-action@v5 |
| 105 | + with: |
| 106 | + images: ${{ env.REGISTRY_IMAGE }} |
| 107 | + tags: | |
| 108 | + type=raw,value=${{ env.TAGS }} |
| 109 | +
|
| 110 | + - name: Create manifest list and push |
| 111 | + working-directory: ${{ runner.temp }}/digests |
| 112 | + run: | |
| 113 | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ |
| 114 | + $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) |
| 115 | +
|
| 116 | + - name: Inspect image |
| 117 | + run: | |
| 118 | + docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} |
0 commit comments