1717 TPC_IMAGE : ghcr.io/${{ github.repository }}-tpc
1818
1919jobs :
20- build :
20+ build-base :
2121 runs-on : ubuntu-latest
2222 permissions :
2323 contents : read
2424 packages : write
25+ outputs :
26+ tag : ${{ steps.version.outputs.tag }}
2527
2628 steps :
2729 - name : Checkout
@@ -46,36 +48,55 @@ jobs:
4648 echo "tag=dev-$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
4749 fi
4850
49- # Step 1: Build base OpenClaw image from upstream Dockerfile
50- - name : Build base OpenClaw image
51+ - name : Build and push base OpenClaw image
5152 uses : docker/build-push-action@v5
5253 with :
5354 context : .
5455 file : Dockerfile
55- push : ${{ github.event_name == 'push' || inputs.push }}
56+ push : true
5657 tags : |
5758 ${{ env.BASE_IMAGE }}:${{ steps.version.outputs.tag }}
5859 ${{ env.BASE_IMAGE }}:latest
59- cache-from : type=gha
60- cache-to : type=gha,mode=max
60+ cache-from : type=gha,scope=base
61+ cache-to : type=gha,scope=base,mode=max
62+
63+ build-tpc :
64+ runs-on : ubuntu-latest
65+ needs : build-base
66+ permissions :
67+ contents : read
68+ packages : write
69+
70+ steps :
71+ - name : Checkout
72+ uses : actions/checkout@v4
73+
74+ - name : Set up Docker Buildx
75+ uses : docker/setup-buildx-action@v3
76+
77+ - name : Log in to GHCR
78+ uses : docker/login-action@v3
79+ with :
80+ registry : ${{ env.REGISTRY }}
81+ username : ${{ github.actor }}
82+ password : ${{ secrets.GITHUB_TOKEN }}
6183
62- # Step 2: Build TPC-extended image on top
63- - name : Build TPC OpenClaw image
84+ - name : Build and push TPC OpenClaw image
6485 uses : docker/build-push-action@v5
6586 with :
6687 context : .
6788 file : Dockerfile.tpc
6889 build-args : |
69- BASE_IMAGE=${{ env.BASE_IMAGE }}:${{ steps.version .outputs.tag }}
90+ BASE_IMAGE=${{ env.BASE_IMAGE }}:${{ needs.build-base .outputs.tag }}
7091 push : ${{ github.event_name == 'push' || inputs.push }}
7192 tags : |
72- ${{ env.TPC_IMAGE }}:${{ steps.version .outputs.tag }}
93+ ${{ env.TPC_IMAGE }}:${{ needs.build-base .outputs.tag }}
7394 ${{ env.TPC_IMAGE }}:latest
74- cache-from : type=gha
75- cache-to : type=gha,mode=max
95+ cache-from : type=gha,scope=tpc
96+ cache-to : type=gha,scope=tpc, mode=max
7697
7798 - name : Summary
7899 run : |
79100 echo "### Built images" >> "$GITHUB_STEP_SUMMARY"
80- echo "- Base: \`${{ env.BASE_IMAGE }}:${{ steps.version .outputs.tag }}\`" >> "$GITHUB_STEP_SUMMARY"
81- echo "- TPC: \`${{ env.TPC_IMAGE }}:${{ steps.version .outputs.tag }}\`" >> "$GITHUB_STEP_SUMMARY"
101+ echo "- Base: \`${{ env.BASE_IMAGE }}:${{ needs.build-base .outputs.tag }}\`" >> "$GITHUB_STEP_SUMMARY"
102+ echo "- TPC: \`${{ env.TPC_IMAGE }}:${{ needs.build-base .outputs.tag }}\`" >> "$GITHUB_STEP_SUMMARY"
0 commit comments