From 098ac5d66600cba58ecdfb2ac0ac372bb094eed4 Mon Sep 17 00:00:00 2001 From: Ryan Boehning <1250684+ryboe@users.noreply.github.com> Date: Sun, 5 Jan 2025 14:58:21 -0800 Subject: [PATCH 1/2] chore: bump default python in base image 3.12 -> 3.13 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a7a243f..3d5b4cb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -ARG PYTHON_VERSION="3.12" +ARG PYTHON_VERSION="3.13" FROM mcr.microsoft.com/devcontainers/python:${PYTHON_VERSION} LABEL org.opencontainers.image.authors="Ryan Boehning <1250684+ryboe@users.noreply.github.com>" From c4c6d6997d0572a4ff1bdb050df3cd3e3cd639d4 Mon Sep 17 00:00:00 2001 From: Ryan Boehning <1250684+ryboe@users.noreply.github.com> Date: Sun, 5 Jan 2025 15:09:50 -0800 Subject: [PATCH 2/2] ci: add matrix build to create Python 3.12 and 3.13 images --- .github/workflows/pr.yml | 9 ++++++++- .github/workflows/release.yml | 31 ++++++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index c9c9199..39df6a9 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -7,6 +7,11 @@ on: jobs: should_build: runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.12" + - "3.13" steps: - name: Set up Docker buildx uses: docker/setup-buildx-action@v3 @@ -17,8 +22,10 @@ jobs: username: ${{ github.actor }} password: ${{ github.token }} - name: Build image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: + build-args: | + GO_VERSION=${{ matrix.python-version }} cache-from: type=gha platforms: linux/amd64 # GitHub only offers AMD64 codespaces pull: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6a4555c..c715f72 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,9 +8,17 @@ on: branches: - main +env: + LATEST_PYTHON_VERSION: "3.13" + jobs: build_and_upload_image: runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.12" + - "3.13" steps: - name: Set up Docker buildx uses: docker/setup-buildx-action@v3 @@ -20,15 +28,32 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ github.token }} - - name: Build and Push - uses: docker/build-push-action@v5 + - name: Build and Push Image + if: ${{ matrix.python-version != env.LATEST_PYTHON_VERSION }} + uses: docker/build-push-action@v6 with: + build-args: | + PYTHON_VERSION=${{ matrix.python-version }} platforms: linux/amd64 # GitHub only offers AMD64 codespaces pull: true push: true - tags: ghcr.io/${{ github.repository }}:latest + tags: ghcr.io/${{ github.repository }}:${{ matrix.python-version }} cache-from: type=gha # mode=max means "cache everything possible". This ensures maximum # use of the cache, but will use up GitHub's 10 GB cache size limit # faster. cache-to: type=gha,mode=max + - name: Build and Push 'latest' Image + if: ${{ matrix.python-version == env.LATEST_PYTHON_VERSION }} + uses: docker/build-push-action@v6 + with: + build-args: | + PYTHON_VERSION=${{ matrix.python-version }} + platforms: linux/amd64 # GitHub only offers AMD64 codespaces + pull: true + push: true + tags: ghcr.io/${{ github.repository }}:${{ matrix.python-version }},ghcr.io/${{ github.repository }}:latest + cache-from: type=gha + # mode=max means "cache everything possible". This ensures maximum + # use of the cache, but will use up GitHub's 10 GB cache size limit + # faster.