Skip to content

Commit cc7232f

Browse files
committed
ci: add matrix build to create Python 3.12 and 3.13 images
1 parent 7b76ee5 commit cc7232f

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

.github/workflows/pr.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
jobs:
88
should_build:
99
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version:
13+
- "3.12"
14+
- "3.13"
1015
steps:
1116
- name: Set up Docker buildx
1217
uses: docker/setup-buildx-action@v3
@@ -17,8 +22,10 @@ jobs:
1722
username: ${{ github.actor }}
1823
password: ${{ github.token }}
1924
- name: Build image
20-
uses: docker/build-push-action@v5
25+
uses: docker/build-push-action@v6
2126
with:
27+
build-args: |
28+
GO_VERSION=${{ matrix.python-version }}
2229
cache-from: type=gha
2330
platforms: linux/amd64 # GitHub only offers AMD64 codespaces
2431
pull: true

.github/workflows/release.yml

+28-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@ on:
88
branches:
99
- main
1010

11+
env:
12+
LATEST_PYTHON_VERSION: "3.13"
13+
1114
jobs:
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

Comments
 (0)