1- name : Docker
1+ name : Build and Release Wheels
22
33on :
44 push :
55 branches : [ "main" ]
66 tags : [ 'v*.*.*' ]
77
8- env :
9- REGISTRY : ghcr.io
10- IMAGE_NAME : ${{ github.repository }}
11-
128jobs :
139 build :
1410 runs-on : ubuntu-latest
1511 permissions :
1612 contents : write
17- packages : write
18- id-token : write
1913
2014 timeout-minutes : 600
2115
6256 swapon --show
6357 free -h
6458
65- - name : Install cosign
66- if : github.event_name != 'pull_request'
67- uses : sigstore/cosign-installer@v3.5.0
59+
6860
6961 - name : Setup Docker buildx
7062 uses : docker/setup-buildx-action@v3
@@ -77,22 +69,10 @@ jobs:
7769 restore-keys : |
7870 buildx-${{ runner.os }}-
7971
80- - name : Log into registry ${{ env.REGISTRY }}
81- if : github.event_name != 'pull_request'
82- uses : docker/login-action@v3
83- with :
84- registry : ${{ env.REGISTRY }}
85- username : ${{ github.actor }}
86- password : ${{ secrets.GITHUB_TOKEN }}
8772
88- - name : Extract Docker metadata
89- id : meta
90- uses : docker/metadata-action@v5
91- with :
92- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
9373
94- # Build and export locally first (fast, includes wheels )
95- - name : Build and export files
74+ # Build and export wheels only (no Docker push )
75+ - name : Build and export wheels
9676 uses : docker/build-push-action@v5
9777 with :
9878 context : .
@@ -101,20 +81,6 @@ jobs:
10181 cache-from : type=local,src=/tmp/.buildx-cache
10282 cache-to : type=local,dest=/tmp/.buildx-cache,mode=max
10383
104- # Push image to registry (using cache, very fast)
105- - name : Push Docker image
106- if : ${{ github.event_name != 'pull_request' }}
107- id : build-and-push
108- uses : docker/build-push-action@v5
109- with :
110- context : .
111- target : main
112- push : true
113- tags : ${{ steps.meta.outputs.tags }}
114- labels : ${{ steps.meta.outputs.labels }}
115- cache-from : type=local,src=/tmp/.buildx-cache
116- # No cache-to here, already cached in first build
117-
11884 # Extract wheels from local export (no docker pull needed!)
11985 - name : Extract wheels
12086 run : |
@@ -131,12 +97,7 @@ jobs:
13197 ls -la ./build-output/
13298 fi
13399
134- - name : Sign the published Docker image
135- if : ${{ github.event_name != 'pull_request' }}
136- env :
137- TAGS : ${{ steps.meta.outputs.tags }}
138- DIGEST : ${{ steps.build-and-push.outputs.digest }}
139- run : echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
100+
140101
141102 - name : Upload .whl to GitHub Release
142103 if : startsWith(github.ref, 'refs/tags/')
0 commit comments