From a52b16214ab1a425772828ff3b984922d623f57a Mon Sep 17 00:00:00 2001 From: Administrator Date: Mon, 4 Nov 2024 12:55:40 -0700 Subject: [PATCH] test ocr build and deploy with changes --- .github/workflows/build-deploy-frontend.yml | 34 ++++++++-------- .github/workflows/build-deploy-ocr.yml | 44 +++++++++++---------- .github/workflows/deploy-dev.yml | 7 +++- 3 files changed, 46 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build-deploy-frontend.yml b/.github/workflows/build-deploy-frontend.yml index 50f5c307..40c1206a 100644 --- a/.github/workflows/build-deploy-frontend.yml +++ b/.github/workflows/build-deploy-frontend.yml @@ -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 @@ -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/ @@ -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 @@ -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 diff --git a/.github/workflows/build-deploy-ocr.yml b/.github/workflows/build-deploy-ocr.yml index 62cfed1f..e6a17ebc 100644 --- a/.github/workflows/build-deploy-ocr.yml +++ b/.github/workflows/build-deploy-ocr.yml @@ -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 @@ -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 }} @@ -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 }} @@ -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 @@ -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 diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 8a9dfd06..8b3b40ab 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -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 }} @@ -53,6 +54,7 @@ jobs: api-name: ocr-api build-frontend: + name: Build Frontend runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -66,6 +68,7 @@ jobs: node-version: 20 environment-setup: + name: Setup Azure Environment runs-on: ubuntu-latest environment: ${{ inputs.deploy-env }} steps: @@ -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] @@ -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]