This repository was archived by the owner on Mar 30, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
101 lines (92 loc) · 3.36 KB
/
Copy pathci.yml
File metadata and controls
101 lines (92 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Build and publish
on: [ push ]
jobs:
detect-changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
changedProjects_python38: ${{ steps.findChanges.outputs.changedProjects_python38 }}
changedProjects_python310: ${{ steps.findChanges.outputs.changedProjects_python310 }}
changedProjects: ${{ steps.findChanges.outputs.changedProjects }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Find changes
id: findChanges
run: |
./bin/ci-find-changes.sh master \
python38:python-3.8/ \
python310:python-3.10/
build:
name: Build ${{ matrix.python-version }}
needs: detect-changes
runs-on: ubuntu-latest
strategy:
matrix:
include:
- python-version: "3.8"
target: python38
changed: ${{ needs.detect-changes.outputs.changedProjects_python38 }}
- python-version: "3.10"
target: python310
changed: ${{ needs.detect-changes.outputs.changedProjects_python310 }}
steps:
- name: Checkout
uses: actions/checkout@v5
if: matrix.changed == '1'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
if: matrix.changed == '1'
- name: Build Docker image
if: matrix.changed == '1'
run: |
echo "Building ${{ matrix.target }}"
docker buildx build \
--tag keboola/docker-custom-python:python-${{ matrix.python-version }} \
--output type=docker,dest=/tmp/docker-custom-python-${{ matrix.target }}.tar \
./python-${{ matrix.python-version }}/
- name: Upload Docker image artifact
uses: actions/upload-artifact@v4
if: matrix.changed == '1'
with:
name: docker-custom-python-${{ matrix.target }}-${{ github.sha }}
path: /tmp/docker-custom-python-${{ matrix.target }}.tar
retention-days: 1
publish-images:
name: Publish images to ACR
if: startsWith(github.ref, 'refs/tags/')
needs: [detect-changes, build]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Push python-3.8 image to ACR
if: needs.detect-changes.outputs.changedProjects_python38 == '1'
uses: ./.github/actions/docker-push
with:
imageCacheKey: python38
sourceImage: keboola/docker-custom-python
sourceTag: python-3.8
targetImage: docker-custom-python
targetTag: python-3.8-${{ github.ref_name }}
acrRegistry: keboola.azurecr.io
acrUsername: docker-custom-python-push
acrPassword: ${{ secrets.DOCKER_CUSTOM_PYTHON_ACR_PASSWORD }}
- name: Push python-3.10 image to ACR
if: needs.detect-changes.outputs.changedProjects_python310 == '1'
uses: ./.github/actions/docker-push
with:
imageCacheKey: python310
sourceImage: keboola/docker-custom-python
sourceTag: python-3.10
targetImage: docker-custom-python
targetTag: python-3.10-${{ github.ref_name }}
acrRegistry: keboola.azurecr.io
acrUsername: docker-custom-python-push
acrPassword: ${{ secrets.DOCKER_CUSTOM_PYTHON_ACR_PASSWORD }}