This repository was archived by the owner on Mar 30, 2026. It is now read-only.
Merge pull request #46 from keboola/ondra/AJDA-2024 #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |