diff --git a/.github/workflows/docker-base.yml b/.github/workflows/docker-base.yml index 18a9a900ea..838e1e8702 100644 --- a/.github/workflows/docker-base.yml +++ b/.github/workflows/docker-base.yml @@ -22,19 +22,20 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - since_last_remote_commit: true - name: Get changed files id: changed-files uses: tj-actions/changed-files@v23.1 with: + since_last_remote_commit: true files: | .docker/Dockerfile moveit2_tutorials.repos + doc/tutorials/* - name: Set up Docker Buildx if: steps.changed-files.outputs.any_changed == 'true' uses: docker/setup-buildx-action@v2 - name: Login to Github Container Registry - if: steps.changed-files.outputs.any_changed == 'true' && env.PUSH == 'true' + if: steps.changed-files.outputs.any_changed == 'true' uses: docker/login-action@v2 with: registry: ghcr.io @@ -58,3 +59,14 @@ jobs: tags: | ${{ env.GH_IMAGE }} # ${{ env.DH_IMAGE }} + - name: Build and Push PR Image + uses: docker/build-push-action@v3 + if: steps.changed-files.outputs.any_changed == 'true' && env.PUSH == 'false' && github.event_name == 'pull_request' + with: + file: .docker/Dockerfile + build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }} + target: base_image + push: true + no-cache: false + tags: | + ${{ env.GH_IMAGE }}-PR-${{ github.head_ref }} diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index 61b940bc70..f85cd74e63 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -19,6 +19,10 @@ jobs: PUSH: ${{ (github.event_name != 'pull_request') && (github.repository == 'ros-planning/moveit2_tutorials') }} steps: + - name: Add -PR- to base image if this is a PR + if: github.event_name == 'pull_request' + run: | + echo "BASE_IMAGE_BRANCH=-PR-${{ github.head_ref }}" >> $GITHUB_ENV - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to Github Container Registry @@ -38,7 +42,9 @@ jobs: uses: docker/build-push-action@v3 with: file: .docker/Dockerfile - build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }} + build-args: | + ROS_DISTRO=${{ matrix.ROS_DISTRO }} + BASE_BRANCH=${{ env.BASE_IMAGE_BRANCH }} target: hello_world_image push: ${{ env.PUSH }} no-cache: false @@ -49,7 +55,9 @@ jobs: uses: docker/build-push-action@v3 with: file: .docker/Dockerfile - build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }} + build-args: | + ROS_DISTRO=${{ matrix.ROS_DISTRO }} + BASE_BRANCH=${{ env.BASE_IMAGE_BRANCH }} target: planning_around_objects_image push: ${{ env.PUSH }} no-cache: false @@ -60,7 +68,9 @@ jobs: uses: docker/build-push-action@v3 with: file: .docker/Dockerfile - build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }} + build-args: | + ROS_DISTRO=${{ matrix.ROS_DISTRO }} + BASE_BRANCH=${{ env.BASE_IMAGE_BRANCH }} target: pick_and_place_image push: ${{ env.PUSH }} no-cache: false diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 4904fb4fe1..07c4c1e405 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,7 +12,7 @@ on: paths: - moveit2_tutorials.repos - .docker/** - - doc/** + - doc/tutorials/** jobs: call-docker-base: