88 branches :
99 - main
1010
11+ env :
12+ LATEST_PYTHON_VERSION : " 3.13"
13+
1114jobs :
1215 build_and_upload_image :
1316 runs-on : ubuntu-latest
17+ strategy :
18+ matrix :
19+ python-version :
20+ - " 3.12"
21+ - " 3.13"
1422 steps :
1523 - name : Set up Docker buildx
1624 uses : docker/setup-buildx-action@v3
@@ -20,15 +28,32 @@ jobs:
2028 registry : ghcr.io
2129 username : ${{ github.actor }}
2230 password : ${{ github.token }}
23- - name : Build and Push
24- uses : docker/build-push-action@v5
31+ - name : Build and Push Image
32+ if : ${{ matrix.python-version != env.LATEST_PYTHON_VERSION }}
33+ uses : docker/build-push-action@v6
2534 with :
35+ build-args : |
36+ PYTHON_VERSION=${{ matrix.python-version }}
2637 platforms : linux/amd64 # GitHub only offers AMD64 codespaces
2738 pull : true
2839 push : true
29- tags : ghcr.io/${{ github.repository }}:latest
40+ tags : ghcr.io/${{ github.repository }}:${{ matrix.python-version }}
3041 cache-from : type=gha
3142 # mode=max means "cache everything possible". This ensures maximum
3243 # use of the cache, but will use up GitHub's 10 GB cache size limit
3344 # faster.
3445 cache-to : type=gha,mode=max
46+ - name : Build and Push 'latest' Image
47+ if : ${{ matrix.python-version == env.LATEST_PYTHON_VERSION }}
48+ uses : docker/build-push-action@v6
49+ with :
50+ build-args : |
51+ PYTHON_VERSION=${{ matrix.python-version }}
52+ platforms : linux/amd64 # GitHub only offers AMD64 codespaces
53+ pull : true
54+ push : true
55+ tags : ghcr.io/${{ github.repository }}:${{ matrix.python-version }},ghcr.io/${{ github.repository }}:latest
56+ cache-from : type=gha
57+ # mode=max means "cache everything possible". This ensures maximum
58+ # use of the cache, but will use up GitHub's 10 GB cache size limit
59+ # faster.
0 commit comments