Skip to content

Commit 5caf7fd

Browse files
committed
ci: test build container images for PRs
Only test build on amd64 to make the test builds fast. Signed-off-by: Markus Lehtonen <[email protected]>
1 parent 5f32e38 commit 5caf7fd

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

.github/workflows/images.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
uses: docker/setup-buildx-action@v3
4242

4343
- name: Log in to registry
44+
if: github.event_name == 'push'
4445
uses: docker/login-action@v3
4546
with:
4647
registry: ghcr.io
@@ -53,11 +54,15 @@ jobs:
5354
if [ "${{ github.ref_type }}" = "tag" ]; then
5455
tag="${{ github.ref_name }}"
5556
else
56-
case "${{ github.ref_name }}" in
57-
main)
58-
tag="unstable"
59-
;;
60-
esac
57+
if "${{ github.event_name }}" = "pull_request" ]; then
58+
tag="pr-${{ github.event.pull_request.number }}"
59+
else
60+
case "${{ github.ref_name }}" in
61+
main)
62+
tag="unstable"
63+
;;
64+
esac
65+
fi
6166
fi
6267
if [ -z "$tag" ]; then
6368
echo "ERROR: failed to determine image tag"
@@ -72,6 +77,6 @@ jobs:
7277
file: ./plugins/Dockerfile
7378
build-args: |
7479
PLUGIN=${{ matrix.image }}
75-
push: true
76-
platforms: linux/amd64,linux/arm64
80+
push: ${{ github.event_name == 'push' }}
81+
platforms: ${{ github.event_name == 'push' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
7782
tags: ghcr.io/${{ github.repository }}/plugins/${{ matrix.image }}:${{ env.TAG_NAME }}

0 commit comments

Comments
 (0)