Skip to content

Commit fdeecf5

Browse files
committed
Fix build on PR
1 parent ae0b858 commit fdeecf5

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

.github/workflows/build-image.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,23 @@ jobs:
7171
registry: ${{ inputs.registry }}
7272
username: ${{ github.actor }}
7373
password: ${{ secrets.GITHUB_TOKEN }}
74+
- name: Build
75+
if: github.event_name == 'pull_request'
76+
id: build
77+
uses: docker/build-push-action@v5
78+
with:
79+
context: ${{ inputs.context }}
80+
platforms: ${{ inputs.platform }}
81+
file: ${{ inputs.dockerfile }}
82+
labels: ${{ steps.meta.outputs.labels }}
83+
outputs: type=docker,name=${{ env.REGISTRY }}/${{ steps.lower-repo.outputs.IMAGE_NAME }}
84+
build-args: |
85+
${{ inputs.build-args }}
86+
BASE=${{ inputs.base }}
87+
cache-from: type=gha
88+
cache-to: type=gha,mode=max
7489
- name: Build and push by digest
90+
if: github.event_name != 'pull_request'
7591
id: build
7692
uses: docker/build-push-action@v5
7793
with:
@@ -87,6 +103,7 @@ jobs:
87103
cache-from: type=gha
88104
cache-to: type=gha,mode=max
89105
- name: Export digest
106+
if: github.event_name != 'pull_request'
90107
run: |
91108
mkdir -p /tmp/digests
92109
digest="${{ steps.build.outputs.digest }}"
@@ -97,6 +114,7 @@ jobs:
97114
SAFE_PLATFORM=$(echo "${{ inputs.platform }}" | sed 's|/|-|g')
98115
echo "name=$SAFE_PLATFORM" >> $GITHUB_OUTPUT
99116
- name: Upload digest
117+
if: github.event_name != 'pull_request'
100118
uses: actions/upload-artifact@v4
101119
with:
102120
name: ${{ inputs.digest-prefix }}${{ steps.platform.outputs.name }}

0 commit comments

Comments
 (0)