ci: publish both build and runtime Docker images

Change-Id: If92f419c0a143d9341ab7e7855e988837c90fb20
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index e324a31..22d6c1c 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -1,10 +1,11 @@
-name: Publish Docker image
+name: Publish Docker images
 on:
   push:
     branches:
       - master
     paths-ignore:
-      - '*.md'
+      - '.editorconfig'
+      - 'examples/**'
       - '.jenkins'
       - '.jenkins.d/**'
       - '.mailmap'
@@ -12,7 +13,6 @@
   workflow_dispatch:
 
 permissions:
-  contents: read
   packages: write
 
 env:
@@ -22,8 +22,8 @@
   publish:
     runs-on: ubuntu-latest
     steps:
-      - name: Checkout repository
-        uses: actions/checkout@v4
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v3
 
       - name: Login to ${{ env.REGISTRY }}
         uses: docker/login-action@v3
@@ -32,18 +32,51 @@
           username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
 
-      - name: Extract metadata
-        id: meta
+      - name: Generate metadata for ndn-cxx-build image
+        id: build-meta
         uses: docker/metadata-action@v5
         with:
-          images: ${{ env.REGISTRY }}/${{ github.repository }}
-          flavor: latest=true
+          images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/ndn-cxx-build
+          tags: |
+            type=ref,event=branch
+            type=raw,value=latest,enable={{is_default_branch}}
+            type=sha
+        env:
+          DOCKER_METADATA_ANNOTATIONS_LEVELS: index,manifest
 
-      - name: Build and push Docker image
+      - name: Build and push ndn-cxx-build image
         uses: docker/build-push-action@v5
         with:
-          context: .
+          build-args: BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
           pull: true
           push: true
-          tags: ${{ steps.meta.outputs.tags }}
-          labels: ${{ steps.meta.outputs.labels }}
+          target: build
+          tags: ${{ steps.build-meta.outputs.tags }}
+          labels: ${{ steps.build-meta.outputs.labels }}
+          annotations: ${{ steps.build-meta.outputs.annotations }}
+          cache-from: type=gha
+          cache-to: type=gha
+
+      - name: Generate metadata for ndn-cxx-runtime image
+        id: runtime-meta
+        uses: docker/metadata-action@v5
+        with:
+          images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/ndn-cxx-runtime
+          tags: |
+            type=ref,event=branch
+            type=raw,value=latest,enable={{is_default_branch}}
+            type=sha
+        env:
+          DOCKER_METADATA_ANNOTATIONS_LEVELS: index,manifest
+
+      - name: Build and push ndn-cxx-runtime image
+        uses: docker/build-push-action@v5
+        with:
+          build-args: BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
+          pull: true
+          push: true
+          tags: ${{ steps.runtime-meta.outputs.tags }}
+          labels: ${{ steps.runtime-meta.outputs.labels }}
+          annotations: ${{ steps.runtime-meta.outputs.annotations }}
+          cache-from: type=gha
+          cache-to: type=gha