11
11
jobs :
12
12
build_docker_images :
13
13
runs-on : ' ubuntu-20.04'
14
+ env :
15
+ latest_python : ' 3.11'
14
16
strategy :
15
17
matrix :
16
- version :
17
- - {'python': ' 3.7', 'latest': false}
18
- - {'python': ' 3.8', 'latest': false}
19
- - {'python': ' 3.9', 'latest': false}
20
- - {'python': ' 3.10', 'latest': false}
21
- - {'python': ' 3.11', 'latest': true}
18
+ python_version :
19
+ - ' 3.7'
20
+ - ' 3.8'
21
+ - ' 3.9'
22
+ - ' 3.10'
23
+ - ' 3.11'
22
24
steps :
23
25
- name : ' Checkout repository'
24
26
uses : actions/checkout@v4
30
32
uses : actions/cache@v3
31
33
with :
32
34
path : /tmp/.buildx-cache
33
- key : ${{ runner.os }}-buildx-python${{ matrix.version.python }}-${{ github.sha }}
35
+ key : ${{ runner.os }}-buildx-python${{ matrix.python_version }}-${{ github.sha }}
34
36
restore-keys : |
35
- ${{ runner.os }}-buildx-python${{ matrix.version.python }}-
37
+ ${{ runner.os }}-buildx-python${{ matrix.python_version }}-
36
38
37
39
- name : Login to DockerHub
38
40
uses : docker/login-action@v3
@@ -45,13 +47,13 @@ jobs:
45
47
with :
46
48
context : .
47
49
file : Dockerfile
48
- build-args : ' PYTHON_VERSION=${{ matrix.version.python }}'
50
+ build-args : ' PYTHON_VERSION=${{ matrix.python_version }}'
49
51
push : ${{ github.ref_type == 'tag' }}
50
52
tags : |
51
- ${{ env.IMAGE_NAME }}:latest-python${{ matrix.version.python }}
52
- ${{ env.IMAGE_NAME }}:${{ github.ref_name }}-python${{ matrix.version.python }}
53
- ${{ matrix.version.latest && format('{0}:{1}', env.IMAGE_NAME, github.ref_name) || '' }}
54
- ${{ matrix.version.latest && format('{0}:latest', env.IMAGE_NAME) || '' }}
53
+ ${{ env.IMAGE_NAME }}:latest-python${{ matrix.python_version }}
54
+ ${{ env.IMAGE_NAME }}:${{ github.ref_name }}-python${{ matrix.python_version }}
55
+ ${{ ( matrix.python_version == env.latest_python) && format('{0}:{1}', env.IMAGE_NAME, github.ref_name) || '' }}
56
+ ${{ ( matrix.python_version == env.latest_python) && format('{0}:latest', env.IMAGE_NAME) || '' }}
55
57
cache-from : |
56
58
type=local,src=/tmp/.buildx-cache
57
59
cache-to : type=local,dest=/tmp/.buildx-cache-new
0 commit comments