|
38 | 38 | required: false
|
39 | 39 | type: boolean
|
40 | 40 | default: false
|
41 |
| - build-cache: |
42 |
| - description: >- |
43 |
| - Use cache when building the image. |
44 |
| - required: false |
45 |
| - type: boolean |
46 |
| - default: true |
47 | 41 | build-cache-key:
|
48 | 42 | description: >-
|
49 | 43 | An explicit key for a cache entry.
|
@@ -96,45 +90,23 @@ jobs:
|
96 | 90 | username: ${{ inputs.registry-username }}
|
97 | 91 | password: ${{ secrets.registry-password }}
|
98 | 92 |
|
99 |
| - - name: Build and push by digest (cached) |
100 |
| - if: ${{ inputs.build-cache }} |
101 |
| - id: build-cache |
| 93 | + - name: Build and push by digest |
| 94 | + id: build |
102 | 95 | uses: docker/build-push-action@v6
|
103 | 96 | with:
|
104 | 97 | cache-from: type=gha,scope=${{ inputs.build-cache-key }}-${{ env.PLATFORM_PAIR }}
|
105 |
| - cache-to: type=gha,scope=${{ inputs.build-cache-key }}-${{ env.PLATFORM_PAIR }},mode=min |
106 |
| - context: ${{ inputs.build-context }} |
107 |
| - file: ${{ inputs.build-file }} |
108 |
| - labels: ${{ steps.meta.outputs.labels }} |
109 |
| - outputs: type=image,name=${{ inputs.registry-image }},push-by-digest=true,name-canonical=true,push=true |
110 |
| - platforms: ${{ matrix.builder.platform }} |
111 |
| - provenance: ${{ inputs.build-provenance }} |
112 |
| - |
113 |
| - - name: Export digest (cached) |
114 |
| - if: ${{ inputs.build-cache }} |
115 |
| - run: | |
116 |
| - mkdir -p ${{ runner.temp }}/digests |
117 |
| - digest="${{ steps.build-cache.outputs.digest }}" |
118 |
| - touch "${{ runner.temp }}/digests/${digest#sha256:}" |
119 |
| -
|
120 |
| - - name: Build and push by digest (no cache) |
121 |
| - if: ${{ ! inputs.build-cache }} |
122 |
| - id: build-no-cache |
123 |
| - uses: docker/build-push-action@v6 |
124 |
| - with: |
| 98 | + cache-to: type=gha,scope=${{ inputs.build-cache-key }}-${{ env.PLATFORM_PAIR }},mode=max |
125 | 99 | context: ${{ inputs.build-context }}
|
126 | 100 | file: ${{ inputs.build-file }}
|
127 | 101 | labels: ${{ steps.meta.outputs.labels }}
|
128 |
| - no-cache: ${{ ! inputs.build-cache }} |
129 | 102 | outputs: type=image,name=${{ inputs.registry-image }},push-by-digest=true,name-canonical=true,push=true
|
130 | 103 | platforms: ${{ matrix.builder.platform }}
|
131 | 104 | provenance: ${{ inputs.build-provenance }}
|
132 | 105 |
|
133 |
| - - name: Export digest (no cache) |
134 |
| - if: ${{ ! inputs.build-cache }} |
| 106 | + - name: Export digest |
135 | 107 | run: |
|
136 | 108 | mkdir -p ${{ runner.temp }}/digests
|
137 |
| - digest="${{ steps.build-no-cache.outputs.digest }}" |
| 109 | + digest="${{ steps.build.outputs.digest }}" |
138 | 110 | touch "${{ runner.temp }}/digests/${digest#sha256:}"
|
139 | 111 |
|
140 | 112 | - name: Upload digest
|
|
0 commit comments