Enabling docker build (no push) on PR

This commit is contained in:
matlabbe
2026-06-20 12:53:46 -07:00
parent 507cb2c483
commit 1014e27b8a
+12 -3
View File
@@ -4,6 +4,9 @@ on:
push:
branches:
- 'master'
pull_request:
branches:
- '**'
jobs:
docker_deps:
@@ -15,7 +18,8 @@ jobs:
# $ sudo apt-get upgrade qemu-user-static
# $ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -c yes
# More info: https://github.com/introlab/rtabmap/issues/1454
# if: false
# Skipped on pull requests; built and pushed only on push to master.
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
@@ -85,6 +89,8 @@ jobs:
docker:
needs: docker_deps
# Run even when docker_deps is skipped (it is, on pull requests).
if: ${{ !cancelled() && !failure() }}
runs-on: ubuntu-latest
strategy:
@@ -190,6 +196,9 @@ jobs:
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
# Only needed when pushing; skipped on pull requests (secrets are
# unavailable for fork PRs and we don't push there anyway).
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -199,8 +208,8 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: ${{ matrix.docker_platforms }}
push: ${{ github.event_name != 'pull_request' }}
platforms: ${{ github.event_name == 'pull_request' && 'linux/amd64' || matrix.docker_platforms }}
file: ./docker/${{ matrix.docker_path }}/Dockerfile
build-args: |
${{ matrix.docker_args }}