2.20.4: We Held a Funeral for the Bugs. No One Came #3209
Workflow file for this run
This file contains 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: Docker images | |
on: | |
# On release events (also when a published release is converted from/to prerelease), push all patterns | |
release: | |
types: [released, prereleased] | |
# On each commit merged into main, push sha and branch patterns to prefect-dev | |
push: | |
branches: main | |
paths: | |
- "Dockerfile" | |
- ".dockerignore" | |
- "setup.py" | |
- "src/**" | |
- "tests/**" | |
- "requirements.txt" | |
- "requirements-client.txt" | |
- "MANIFEST.in" | |
- "setup.cfg" | |
- "versioneer.py" | |
- ".gitingore" | |
- ".gitattributes" | |
- ".github/workflows/docker-images.yaml" | |
- "ui/**" | |
# On workflow_dispatch, push sha and branch patterns to prefect-dev | |
workflow_dispatch: | |
jobs: | |
publish-docker-images: | |
name: Build and publish to DockerHub | |
runs-on: ubuntu-latest | |
environment: ${{ ( github.event_name == 'release' && 'prod' ) || 'dev' }} | |
strategy: | |
matrix: | |
flavor: | |
- "" | |
- "-conda" | |
- "-kubernetes" | |
python-version: | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
- "3.12" | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver-opts: image=moby/buildkit:v0.12.5 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Generate tags for prefecthq/prefect-dev | |
id: metadata-dev | |
uses: docker/metadata-action@v5 | |
# do not generate the development tags on release events | |
if: ${{ github.event_name != 'release' }} | |
with: | |
images: prefecthq/prefect-dev | |
tags: | | |
type=raw,value=${{ github.ref_name }},suffix=-python${{ matrix.python-version }}${{ matrix.flavor }} | |
type=sha,suffix=-python${{ matrix.python-version }}${{ matrix.flavor }} | |
flavor: | | |
latest=false | |
- name: Determine latest tag | |
# https://stackoverflow.com/a/75079768/5511061 | |
run: | | |
echo "LATEST_TAG=$(curl -qsSL \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
"${{ github.api_url }}/repos/${{ github.repository }}/releases/latest" \ | |
| jq -r .tag_name)" >> $GITHUB_ENV | |
- name: Generate tags for prefecthq/prefect | |
id: metadata-prod | |
uses: docker/metadata-action@v5 | |
# only generate the production tags on release events | |
if: ${{ github.event_name == 'release' }} | |
with: | |
images: prefecthq/prefect | |
# push `latest`, `X.Y` and `X` tags only when the release is not marked as prerelease | |
# push `latest` and `X` tags only when the release is marked as latest | |
tags: | | |
type=pep440,pattern={{version}},suffix=-python${{ matrix.python-version }}${{ matrix.flavor }} | |
type=pep440,pattern={{major}}.{{minor}},suffix=-python${{ matrix.python-version }}${{ matrix.flavor }},enable=${{ github.event.release.prerelease == false }} | |
type=pep440,pattern={{major}},suffix=-python${{ matrix.python-version }}${{ matrix.flavor }},enable=${{ github.event.release.prerelease == false && github.ref_name == env.LATEST_TAG }} | |
type=raw,value=2-latest${{ matrix.flavor }},enable=${{ matrix.python-version == '3.10' && github.event.release.prerelease == false && github.ref_name == env.LATEST_TAG }} | |
flavor: | | |
latest=false | |
- name: Build and push image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
build-args: | | |
PYTHON_VERSION=${{ matrix.python-version }} | |
${{ ( endsWith(matrix.flavor, 'conda') && 'BASE_IMAGE=prefect-conda' ) || '' }} | |
${{ ( endsWith(matrix.flavor, 'kubernetes') && 'EXTRA_PIP_PACKAGES=prefect-kubernetes' ) || '' }} | |
tags: ${{ join(steps.metadata-dev.outputs.tags) }},${{ join(steps.metadata-prod.outputs.tags) }} | |
labels: ${{ steps.metadata-dev.outputs.labels }} | |
push: true | |
pull: true | |
provenance: false |