8
8
branches :
9
9
- main
10
10
11
+ env :
12
+ LATEST_PYTHON_VERSION : " 3.13"
13
+
11
14
jobs :
12
15
build_and_upload_image :
13
16
runs-on : ubuntu-latest
17
+ strategy :
18
+ matrix :
19
+ python-version :
20
+ - " 3.12"
21
+ - " 3.13"
14
22
steps :
15
23
- name : Set up Docker buildx
16
24
uses : docker/setup-buildx-action@v3
@@ -20,15 +28,32 @@ jobs:
20
28
registry : ghcr.io
21
29
username : ${{ github.actor }}
22
30
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
25
34
with :
35
+ build-args : |
36
+ PYTHON_VERSION=${{ matrix.python-version }}
26
37
platforms : linux/amd64 # GitHub only offers AMD64 codespaces
27
38
pull : true
28
39
push : true
29
- tags : ghcr.io/${{ github.repository }}:latest
40
+ tags : ghcr.io/${{ github.repository }}:${{ matrix.python-version }}
30
41
cache-from : type=gha
31
42
# mode=max means "cache everything possible". This ensures maximum
32
43
# use of the cache, but will use up GitHub's 10 GB cache size limit
33
44
# faster.
34
45
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