Skip to content

Commit

Permalink
👷 Update deploy CI to remove duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo committed Mar 17, 2024
1 parent a29dcb9 commit 65d29c7
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.0
- name: Set Dockerfile name
if: matrix.image.name != 'latest'
run: echo "DOCKERFILE_NAME=${{ matrix.image.name }}" >> $GITHUB_ENV
- name: Set Dockerfile name latest
if: matrix.image.name == 'latest'
run: echo "DOCKERFILE_NAME=python${{ matrix.image.python_version }}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
Expand All @@ -49,7 +55,6 @@ jobs:
- name: Get date for tags
run: echo "DATE_TAG=$(date -I)" >> "$GITHUB_ENV"
- name: Build and push
if: matrix.image.name != 'latest'
uses: docker/build-push-action@v2
with:
push: true
Expand All @@ -59,16 +64,7 @@ jobs:
tiangolo/uvicorn-gunicorn:${{ matrix.image.name }}-debug
tiangolo/uvicorn-gunicorn:${{ matrix.image.name }}-debug-${{ env.DATE_TAG }}
context: ./docker-images/
file: ./docker-images/${{ matrix.image.name }}.dockerfile
- name: Build and push latest
if: matrix.image.name == 'latest'
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/amd64,linux/arm64
tags: tiangolo/uvicorn-gunicorn:latest-debug
context: ./docker-images/
file: ./docker-images/python${{ matrix.image.python_version }}.dockerfile
file: ./docker-images/${{ env.DOCKERFILE_NAME }}.dockerfile
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
Expand Down

0 comments on commit 65d29c7

Please sign in to comment.