Skip to content

Commit fc7d649

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 <markus.lehtonen@intel.com>
1 parent 95a0f56 commit fc7d649

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

.github/workflows/images.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- main
77
tags:
88
- v[0-9]+.[0-9]+.[0-9]+
9+
pull_request:
910

1011
concurrency:
1112
group: ${{ github.workflow }}-${{ github.ref }}
@@ -41,6 +42,7 @@ jobs:
4142
uses: docker/setup-buildx-action@v3
4243

4344
- name: Log in to registry
45+
if: github.event_name == 'push'
4446
uses: docker/login-action@v3
4547
with:
4648
registry: ghcr.io
@@ -53,11 +55,15 @@ jobs:
5355
if [ "${{ github.ref_type }}" = "tag" ]; then
5456
tag="${{ github.ref_name }}"
5557
else
56-
case "${{ github.ref_name }}" in
57-
main)
58-
tag="unstable"
59-
;;
60-
esac
58+
if [ "${{ github.event_name }}" = "pull_request" ]; then
59+
tag="pr-${{ github.event.pull_request.number }}"
60+
else
61+
case "${{ github.ref_name }}" in
62+
main)
63+
tag="unstable"
64+
;;
65+
esac
66+
fi
6167
fi
6268
if [ -z "$tag" ]; then
6369
echo "ERROR: failed to determine image tag"
@@ -72,6 +78,6 @@ jobs:
7278
file: ./plugins/Dockerfile
7379
build-args: |
7480
PLUGIN=${{ matrix.image }}
75-
push: true
76-
platforms: linux/amd64,linux/arm64
81+
push: ${{ github.event_name == 'push' }}
82+
platforms: ${{ github.event_name == 'push' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
7783
tags: ghcr.io/${{ github.repository }}/plugins/${{ matrix.image }}:${{ env.TAG_NAME }}

0 commit comments

Comments
 (0)