diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c1f49f..7ce0841 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,3 +83,49 @@ jobs: uv publish \ --trusted-publishing always \ dist/* + + image_build: + runs-on: ubuntu-latest + name: Build the docker images + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + enable-cache: true + version: ${{ env.UV_VERSION }} + + - name: Set up docker buildx + uses: docker/setup-buildx-action@v4 + + - name: Log in to GHCR + if: github.ref != 'refs/heads/main' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build codejail image + env: + TUTOR_ROOT: /tmp/tutor-root + run: | + REF="${GITHUB_REF_NAME,,}" + IMAGE="ghcr.io/${GITHUB_REPOSITORY,,}/codejail:test-${REF//\//-}" + uv run tutor plugins disable mfe indigo + uv run tutor plugins enable codejail + uv run tutor config save --set CODEJAIL_DOCKER_IMAGE="$IMAGE" + uv run tutor images build codejail \ + -d "--cache-from=type=gha" \ + -d "--cache-to=type=gha,mode=max" + + - name: Push test codejail image + if: github.ref != 'refs/heads/main' + env: + TUTOR_ROOT: /tmp/tutor-root + run: uv run tutor images push codejail