@@ -91,28 +91,45 @@ jobs:
9191 with :
9292 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
9393
94- # Build and export wheels directly (fastest method )
95- - name : Build and export wheels
94+ # Build and export locally first (fast, includes wheels )
95+ - name : Build and export files
9696 uses : docker/build-push-action@v5
9797 with :
9898 context : .
99- target : wheels # We'll add this target to Dockerfile
100- outputs : type=local,dest=./out
99+ target : main
100+ outputs : type=local,dest=./build-output
101101 cache-from : type=local,src=/tmp/.buildx-cache
102102 cache-to : type=local,dest=/tmp/.buildx-cache,mode=max
103-
104- # Build and push the complete image (main stage)
105- - name : Build and push Docker image
103+
104+ # Push image to registry (using cache, very fast)
105+ - name : Push Docker image
106+ if : ${{ github.event_name != 'pull_request' }}
106107 id : build-and-push
107108 uses : docker/build-push-action@v5
108109 with :
109110 context : .
110- target : main # 构建主阶段(完整可用镜像)
111- push : ${{ github.event_name != 'pull_request' }}
111+ target : main
112+ push : true
112113 tags : ${{ steps.meta.outputs.tags }}
113114 labels : ${{ steps.meta.outputs.labels }}
114115 cache-from : type=local,src=/tmp/.buildx-cache
115- cache-to : type=local,dest=/tmp/.buildx-cache,mode=max
116+ # No cache-to here, already cached in first build
117+
118+ # Extract wheels from local export (no docker pull needed!)
119+ - name : Extract wheels
120+ run : |
121+ echo "📦 Extracting wheels from build output..."
122+ mkdir -p ./out
123+ if [ -d "./build-output/out" ]; then
124+ cp ./build-output/out/*.whl ./out/
125+ echo "✅ Wheels extracted from build output:"
126+ ls -la ./out/*.whl
127+ echo "Total wheels: $(ls -1 ./out/*.whl | wc -l)"
128+ else
129+ echo "❌ Warning: /out directory not found in build output"
130+ echo "Available directories:"
131+ ls -la ./build-output/
132+ fi
116133
117134 - name : Sign the published Docker image
118135 if : ${{ github.event_name != 'pull_request' }}
@@ -121,12 +138,6 @@ jobs:
121138 DIGEST : ${{ steps.build-and-push.outputs.digest }}
122139 run : echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
123140
124- - name : Verify exported wheels
125- run : |
126- echo "Wheel files exported directly during build:"
127- ls -la ./out/
128- echo "Wheel count: $(ls -1 ./out/*.whl | wc -l)"
129-
130141 - name : Upload .whl to GitHub Release
131142 if : startsWith(github.ref, 'refs/tags/')
132143 env :
0 commit comments