Skip to content

Commit

Permalink
test ocr build and deploy with changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Administrator committed Nov 4, 2024
1 parent 4a8f6cb commit a52b162
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 39 deletions.
34 changes: 16 additions & 18 deletions .github/workflows/build-deploy-frontend.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
name: Build and Deploy Frontend

on:
push:
branches: fix-docker-image-check
# workflow_dispatch:
# inputs:
# deploy-env:
# description: 'The environment to deploy to'
# required: true
# type: choice
# options:
# - dev
# - demo
# demo-blob-name:
# description: 'After the demo env gets created, copy its blob storage name here'
# required: false
workflow_dispatch:
inputs:
deploy-env:
description: 'The environment to deploy to'
required: true
type: choice
options:
- dev
- demo
demo-blob-name:
description: 'After the demo env gets created, copy its blob storage name here'
required: false

permissions:
id-token: write
Expand All @@ -28,7 +26,7 @@ jobs:
- uses: ./.github/actions/build-frontend
name: Build frontend
with:
api-endpoint: https://reportvision-ocr-dev.azurewebsites.net/
api-endpoint: https://reportvision-ocr-${{ inputs.deploy-env }}.azurewebsites.net/
frontend-tarball: ./frontend.tgz
frontend-path: ./frontend
frontend-build-path: ./frontend/dist/
Expand All @@ -37,7 +35,7 @@ jobs:
deploy-with-blob-name-optional:
name: Deploy
runs-on: ubuntu-latest
environment: dev
environment: ${{ inputs.deploy-env }}
needs: [build-frontend]
steps:
- name: Download Artifacts To Job
Expand All @@ -58,8 +56,8 @@ jobs:
- name: Upload to Azure blob storage
shell: bash
run: |
if [ -z "" ]; then
az storage blob upload-batch --account-name reportvisionfrontenddev -d '$web' -s frontend-deploy/ --overwrite
if [ -z "${{ inputs.demo-blob-name }}" ]; then
az storage blob upload-batch --account-name reportvisionfrontend${{ inputs.deploy-env }} -d '$web' -s frontend-deploy/ --overwrite
else
az storage blob upload-batch --account-name ${{ inputs.demo-blob-name }} -d '$web' -s frontend-deploy/ --overwrite
fi
Expand Down
44 changes: 24 additions & 20 deletions .github/workflows/build-deploy-ocr.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
name: Create, publish, deploy a OCR API image

on:
workflow_dispatch:
inputs:
deploy-env:
description: 'The environment to deploy to'
required: true
type: choice
options:
- dev
- demo
ocr-version:
description: 'Create a version for this OCR API image'
required: true
push:
branches: fix-docker-image-check
# workflow_dispatch:
# inputs:
# deploy-env:
# description: 'The environment to deploy to'
# required: true
# type: choice
# options:
# - dev
# - demo
# ocr-version:
# description: 'Create a version for this OCR API image'
# required: true

permissions:
contents: read
Expand All @@ -21,7 +23,8 @@ permissions:
id-token: write

jobs:
build-and-push-image:
build-publish-ocr:
name: Build and Publish OCR
runs-on: ubuntu-latest
outputs:
docker_inspect: ${{ steps.image_check.outputs.docker_inspect }}
Expand All @@ -40,7 +43,7 @@ jobs:
id: image_check
run: |
echo "docker_inspect=$(
docker manifest inspect ghcr.io/${{ env.REPO }}-ocr-api:${{ inputs.deploy-env }} > /dev/null ; echo $?
docker manifest inspect ghcr.io/${{ env.REPO }}-ocr-api:derek-clean-up-test > /dev/null ; echo $?
)" >> $GITHUB_OUTPUT
- name: Build and Push backend
if: ${{ steps.image_check.outputs.docker_inspect == 1 }}
Expand All @@ -49,15 +52,16 @@ jobs:
docker-registry: ghcr.io
docker-pw: ${{ secrets.GITHUB_TOKEN }}
docker-username: ${{ github.actor }}
docker-tag: ${{ inputs.ocr-version }}
docker-tag: derek-clean-up-test
dockerfile-path: ./OCR/Dockerfile
docker-context-path: ./OCR/
api-name: ocr-api

deploy-ocr-api:
deploy-ocr:
name: Deploy OCR
runs-on: ubuntu-latest
environment: ${{ inputs.deploy-env }}
needs: [build-and-push-image]
environment: dev
needs: [build-publish-ocr]
steps:
- uses: actions/checkout@v4
- uses: azure/login@v2
Expand All @@ -68,7 +72,7 @@ jobs:
- name: Deploy OCR-API
uses: ./.github/actions/deploy-api
with:
deploy-env: ${{ inputs.deploy-env }}
docker-tag: ${{ inputs.ocr-version }}
deploy-env: dev
docker-tag: derek-clean-up-test
docker-registry: ghcr.io
api-name: ocr-api
7 changes: 6 additions & 1 deletion .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ permissions:

jobs:
build-publish-ocr:
name: Build and Publish OCR
runs-on: ubuntu-latest
outputs:
docker_inspect: ${{ steps.image_check.outputs.docker_inspect }}
Expand All @@ -53,6 +54,7 @@ jobs:
api-name: ocr-api

build-frontend:
name: Build Frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -66,6 +68,7 @@ jobs:
node-version: 20

environment-setup:
name: Setup Azure Environment
runs-on: ubuntu-latest
environment: ${{ inputs.deploy-env }}
steps:
Expand All @@ -85,7 +88,8 @@ jobs:
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
app-name: reportvision

deploy-ocr-api:
deploy-ocr:
name: Deploy OCR
runs-on: ubuntu-latest
environment: ${{ inputs.deploy-env }}
needs: [build-publish-ocr, environment-setup]
Expand All @@ -105,6 +109,7 @@ jobs:
api-name: ocr-api

deploy-frontend:
name: Deploy Frontend
runs-on: ubuntu-latest
environment: ${{ inputs.deploy-env }}
needs: [build-frontend, environment-setup]
Expand Down

0 comments on commit a52b162

Please sign in to comment.