Skip to content

Commit

Permalink
Ensure conda flavored images are published during a release (PrefectH…
Browse files Browse the repository at this point in the history
  • Loading branch information
bunchesofdonald committed Jul 26, 2022
1 parent e6eff0c commit b60c7c7
Showing 1 changed file with 96 additions and 1 deletion.
97 changes: 96 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,67 @@ jobs:
name: release-image-${{ github.sha }}-${{ matrix.python-version }}
path: /tmp/image.tar

build-conda-docker-images:
name: Build Conda Docker images
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"

steps:
# Not needed until we want multiarchecture builds
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Generate image metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: prefecthq/prefect
tags: |
type=pep440,pattern={{version}}
type=pep440,pattern={{major}}.{{minor}}
type=pep440,pattern={{major}}
type=sha
flavor: |
latest=false
suffix=-python${{ matrix.python-version }}-conda
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build image
uses: docker/build-push-action@v3
with:
context: .
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
BASE_IMAGE=prefect-conda
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
outputs: type=docker,dest=/tmp/image-conda.tar

- name: Test docker image
run: |
docker load --input /tmp/image-conda.tar
docker run --rm prefecthq/prefect:sha-${GITHUB_SHA::7}-python${{ matrix.python-version }}-conda prefect version
- name: Upload image artifact
uses: actions/upload-artifact@v3
# Images are stashed for publish after approval is given
with:
name: release-image-${{ github.sha }}-${{ matrix.python-version }}-conda
path: /tmp/image-conda.tar

publish-docs:
name: Open PR to docs branch
needs: [build-release, publish-test-release]
Expand Down Expand Up @@ -188,7 +249,13 @@ jobs:

publish-docker-images:
name: Publish to DockerHub
needs: [build-docker-images, build-release, publish-test-release]
needs:
[
build-docker-images,
build-conda-docker-images,
build-release,
publish-test-release,
]
environment: "prod"

runs-on: ubuntu-latest
Expand Down Expand Up @@ -217,12 +284,40 @@ jobs:
name: release-image-${{ github.sha }}-3.10
path: /tmp/3.10/

- name: Download conda image artifacts for Python 3.7
uses: actions/download-artifact@v3
with:
name: release-image-${{ github.sha }}-3.7-conda
path: /tmp/3.7/

- name: Download conda image artifacts for Python 3.8
uses: actions/download-artifact@v3
with:
name: release-image-${{ github.sha }}-3.8-conda
path: /tmp/3.8/

- name: Download conda image artifacts for Python 3.9
uses: actions/download-artifact@v3
with:
name: release-image-${{ github.sha }}-3.9-conda
path: /tmp/3.9/

- name: Download conda image artifacts for Python 3.10
uses: actions/download-artifact@v3
with:
name: release-image-${{ github.sha }}-3.10-conda
path: /tmp/3.10/

- name: Load images
run: |
docker load --input /tmp/3.7/image.tar
docker load --input /tmp/3.8/image.tar
docker load --input /tmp/3.9/image.tar
docker load --input /tmp/3.10/image.tar
docker load --input /tmp/3.7/image-conda.tar
docker load --input /tmp/3.8/image-conda.tar
docker load --input /tmp/3.9/image-conda.tar
docker load --input /tmp/3.10/image-conda.tar
- name: Login to DockerHub
uses: docker/login-action@v2
Expand Down

0 comments on commit b60c7c7

Please sign in to comment.