Skip to content

Commit

Permalink
merge main change
Browse files Browse the repository at this point in the history
  • Loading branch information
marycrawford committed Dec 3, 2024
1 parent 50ae0e5 commit 45fa780
Showing 1 changed file with 39 additions and 15 deletions.
54 changes: 39 additions & 15 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ on:
options:
- dev
- demo
ocr-version:
description: 'Create a version for this OCR API image'
required: true
middleware-version:
description: 'Create a version for this middleware API image'
required: true
ocr-docker-tag:
description: 'This is optional if you would like to deploy an already published OCR-API image'
required: false
middleware-docker-tag:
description: 'This is optional if you would like to deploy an already published Middleware-API image'
required: false

permissions:
contents: read
Expand All @@ -29,15 +29,25 @@ jobs:
runs-on: ubuntu-latest
outputs:
docker_inspect: ${{ steps.image_check.outputs.docker_inspect }}
docker_tag: ${{ steps.set_tag.outputs.docker_tag }}
steps:
- uses: actions/checkout@v4
- name: Lowercase the repo name
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: Set Middleware Docker tag
shell: bash
id: set_tag
run: |
USER_INPUT="${{ github.event.inputs.middleware-docker-tag }}"
echo "docker_tag=$(
#this gives a new sha as default if dispatch input is empty
echo ${USER_INPUT:-"${{ github.sha }}"}
)" >> $GITHUB_OUTPUT
- name: Check if image exists
id: image_check
run: |
echo "docker_inspect=$(
docker manifest inspect ghcr.io/${{ env.REPO }}-middleware-api:${{ inputs.middleware-version }} > /dev/null ; echo $?
docker manifest inspect ghcr.io/${{ env.REPO }}-middleware:${{ steps.set_tag.outputs.docker_tag }} > /dev/null ; echo $?
)" >> $GITHUB_OUTPUT
- name: Build and Push the middleware
if: ${{ steps.image_check.outputs.docker_inspect == 1 }}
Expand All @@ -46,25 +56,35 @@ jobs:
docker-registry: ghcr.io
docker-pw: ${{ secrets.GITHUB_TOKEN }}
docker-username: ${{ github.actor }}
docker-tag: ${{ inputs.middleware-version }}
docker-tag: ${{ steps.set_tag.outputs.docker_tag }}
dockerfile-path: ./backend/Dockerfile
docker-context-path: ./backend/
api-name: middleware-api
api-name: middleware

build-publish-ocr:
name: Build and Publish OCR
runs-on: ubuntu-latest
outputs:
docker_inspect: ${{ steps.image_check.outputs.docker_inspect }}
docker_tag: ${{ steps.set_tag.outputs.docker_tag }}
steps:
- uses: actions/checkout@v4
- name: Lowercase the repo name
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: Set OCR Docker tag
shell: bash
id: set_tag
run: |
USER_INPUT="${{ github.event.inputs.ocr-docker-tag }}"
echo "docker_tag=$(
#this gives a new sha as default if dispatch input is empty
echo ${USER_INPUT:-"${{ github.sha }}"}
)" >> $GITHUB_OUTPUT
- name: Check if image exists
id: image_check
run: |
echo "docker_inspect=$(
docker manifest inspect ghcr.io/${{ env.REPO }}-ocr-api:${{ inputs.ocr-version }} > /dev/null ; echo $?
docker manifest inspect ghcr.io/${{ env.REPO }}-ocr:${{ steps.set_tag.outputs.docker_tag }} > /dev/null ; echo $?
)" >> $GITHUB_OUTPUT
- name: Build and Push the OCR
if: ${{ steps.image_check.outputs.docker_inspect == 1 }}
Expand All @@ -73,10 +93,10 @@ jobs:
docker-registry: ghcr.io
docker-pw: ${{ secrets.GITHUB_TOKEN }}
docker-username: ${{ github.actor }}
docker-tag: ${{ inputs.ocr-version }}
docker-tag: ${{ steps.set_tag.outputs.docker_tag }}
dockerfile-path: ./OCR/Dockerfile
docker-context-path: ./OCR/
api-name: ocr-api
api-name: ocr

build-frontend:
name: Build Frontend
Expand Down Expand Up @@ -129,9 +149,9 @@ jobs:
uses: ./.github/actions/deploy-api
with:
deploy-env: ${{ inputs.deploy-env }}
docker-tag: ${{ inputs.middleware-version }}
docker-tag: ${{ needs.build-publish-middleware.outputs.docker_tag }}
docker-registry: ghcr.io
api-name: middleware-api
api-name: middleware

deploy-ocr:
name: Deploy OCR
Expand All @@ -149,11 +169,15 @@ jobs:
uses: ./.github/actions/deploy-api
with:
deploy-env: ${{ inputs.deploy-env }}
docker-tag: ${{ inputs.ocr-version }}
docker-tag: ${{ needs.build-publish-ocr.outputs.docker_tag }}
docker-registry: ghcr.io
<<<<<<< HEAD
api-name: ocr-api
- name: Download all workflow run artifacts
uses: actions/download-artifact@v4
=======
api-name: ocr
>>>>>>> 68d5be6b460a530cff13a85e36797c9f25d82da1

deploy-frontend:
name: Deploy Frontend
Expand Down

0 comments on commit 45fa780

Please sign in to comment.