Skip to content

feat: hello world, nemoclaw community #10

feat: hello world, nemoclaw community

feat: hello world, nemoclaw community #10

# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
name: Build Sandbox Images
on:
push:
branches: [main]
paths:
- "sandboxes/**"
pull_request:
branches: [main]
paths:
- "sandboxes/**"
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_PREFIX: ${{ github.repository }}
permissions:
contents: read
packages: write
jobs:
# ---------------------------------------------------------------------------
# Detect which sandbox images have changed
# ---------------------------------------------------------------------------
detect-changes:
name: Detect changed sandboxes
runs-on: ubuntu-latest
outputs:
sandboxes: ${{ steps.changes.outputs.sandboxes }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine changed sandboxes
id: changes
run: |
set -euo pipefail
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
# Build all sandboxes on manual trigger
SANDBOXES=$(find sandboxes -mindepth 1 -maxdepth 1 -type d -exec test -f {}/Dockerfile \; -print \
| xargs -I{} basename {} \
| jq -R -s -c 'split("\n") | map(select(length > 0))')
else
# Only build sandboxes whose files changed
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE_SHA="${{ github.event.pull_request.base.sha }}"
else
BASE_SHA="${{ github.event.before }}"
fi
SANDBOXES=$(git diff --name-only "$BASE_SHA" "${{ github.sha }}" -- sandboxes/ \
| cut -d'/' -f2 \
| sort -u \
| while read -r name; do
if [ -f "sandboxes/${name}/Dockerfile" ]; then echo "$name"; fi
done \
| jq -R -s -c 'split("\n") | map(select(length > 0))')
fi
echo "sandboxes=${SANDBOXES}" >> "$GITHUB_OUTPUT"
echo "Will build: ${SANDBOXES}"
# ---------------------------------------------------------------------------
# Build and push each changed sandbox image
# ---------------------------------------------------------------------------
build:
name: Build ${{ matrix.sandbox }}
needs: detect-changes
if: needs.detect-changes.outputs.sandboxes != '[]'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sandbox: ${{ fromJson(needs.detect-changes.outputs.sandboxes) }}
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/sandboxes/${{ matrix.sandbox }}
tags: |
type=sha,prefix=
type=ref,event=branch
type=ref,event=pr
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: sandboxes/${{ matrix.sandbox }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.sandbox }}
cache-to: type=gha,mode=max,scope=${{ matrix.sandbox }}