Skip to content

Commit 75418af

Browse files
committed
feat(ci): build multiple python version images
3.11 is the default
1 parent 511b551 commit 75418af

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

.github/workflows/publish-devcontainer.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ defaults:
1313
jobs:
1414
publish:
1515
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
python-version: ["3.10", "3.11", "3.12"]
1619

1720
steps:
1821
- name: Checkout
1922
uses: actions/checkout@v4
2023

21-
- name: Docker Login to GitHub Container Registry
24+
- name: Docker Login to GHCR
2225
uses: docker/login-action@v3
2326
with:
2427
registry: ghcr.io
@@ -29,16 +32,18 @@ jobs:
2932
id: buildx
3033
uses: docker/setup-buildx-action@v3
3134

32-
- name: Build, tag, and push image to GitHub Container Registry
35+
- name: Build, tag, and push image to GHCR [python ${{ matrix.python-version }}]
3336
uses: docker/build-push-action@v6
3437
with:
3538
builder: ${{ steps.buildx.outputs.name }}
36-
build-args: GIT-SHA=${{ github.sha }}
39+
build-args: |
40+
GIT-SHA=${{ github.sha }}
41+
PYTHON_VERSION=${{ matrix.python-version }}
3742
cache-from: type=gha,scope=compilerla
3843
cache-to: type=gha,scope=compilerla,mode=max
3944
context: .
4045
file: .devcontainer/Dockerfile
4146
push: true
4247
tags: |
43-
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
44-
ghcr.io/${{ github.repository }}:${{ github.sha }}
48+
${{ matrix.python-version == '3.11' && format('ghcr.io/{0}:main', github.repository) || format('ghcr.io/{0}:main_{1}', github.repository, matrix.python-version) }}
49+
${{ matrix.python-version == '3.11' && format('ghcr.io/{0}:{1}', github.repository, github.sha) || format('ghcr.io/{0}:{1}_{2}', github.repository, github.sha, matrix.python-version) }}

0 commit comments

Comments
 (0)