Skip to content

Commit

Permalink
try building and deploying ocr api in same workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Administrator committed Oct 17, 2024
1 parent 9ab22d9 commit 65f5836
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 50 deletions.
28 changes: 28 additions & 0 deletions .github/actions/deploy-api/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Deploy ReportVisions OCR-API
description: Deploy the OCR-API to Azure App Service in the appropriate environment.
inputs:
deploy-env:
description: The environment being deployed (e.g. "prod" or "test")
required: true
docker-tag:
description: The path to the tar file containing the client code to deploy
required: true
docker-registry:
description: The path to the tar file containing the client code to deploy
required: true
api-name:
description: The path to the tar file containing the client code to deploy
required: true

runs:
using: composite
steps:
- name: Lowercase the repo name
shell: bash
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: reportvision-ocr-${{ inputs.deploy-env }}
images: '${{ inputs.docker-registry }}/${{ env.REPO}}-${{ inputs.api-name }}:${{ inputs.docker-tag }}'
Empty file.
105 changes: 55 additions & 50 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,70 +30,75 @@ env:
NODE_VERSION: 20

jobs:
# build-publish-ocr:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Build and Push backend
# uses: ./.github/actions/build-publish-api
# with:
# docker-registry: ghcr.io
# docker-pw: ${{ secrets.GITHUB_TOKEN }}
# docker-username: ${{ github.actor }}
# docker-tag: ${{ inputs.ocr-version }}
# dockerfile-path: ./OCR/Dockerfile
# docker-context-path: ./OCR/
# api-name: ocr-api

build-frontend:
build-publish-ocr:
runs-on: ubuntu-latest
environment: dev2
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build-frontend
name: Build frontend
- name: Build and Push backend
uses: ./.github/actions/build-publish-api
with:
api-endpoint: https://reportvision-ocr-dev2.azurewebsites.net/
frontend-tarball: ./frontend.tgz
deploy-env: dev2
frontend-path: ./frontend
frontend-build-path: ./frontend/dist/
docker-registry: ghcr.io
docker-pw: ${{ secrets.GITHUB_TOKEN }}
docker-username: ${{ github.actor }}
docker-tag: ${{ inputs.ocr-version }}
dockerfile-path: ./OCR/Dockerfile
docker-context-path: ./OCR/
api-name: ocr-api

environment-setup:
runs-on: ubuntu-latest
environment: dev2
steps:
- uses: actions/checkout@v4
- uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- uses: ./.github/actions/tf-setup
name: Setup this environment with Terraform
with:
deploy-env: dev2
azure-resource-group: reportvision-rg-dev2
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
app-name: reportvision
# build-frontend:
# runs-on: ubuntu-latest
# environment: dev2
# steps:
# - uses: actions/checkout@v4
# - uses: ./.github/actions/build-frontend
# name: Build frontend
# with:
# api-endpoint: https://reportvision-ocr-dev2.azurewebsites.net/
# frontend-tarball: ./frontend.tgz
# deploy-env: dev2
# frontend-path: ./frontend
# frontend-build-path: ./frontend/dist/

# environment-setup:
# runs-on: ubuntu-latest
# environment: dev2
# steps:
# - uses: actions/checkout@v4
# - uses: azure/login@v2
# with:
# client-id: ${{ secrets.AZURE_CLIENT_ID }}
# tenant-id: ${{ secrets.AZURE_TENANT_ID }}
# subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# - uses: ./.github/actions/tf-setup
# name: Setup this environment with Terraform
# with:
# deploy-env: dev2
# azure-resource-group: reportvision-rg-dev2
# azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
# azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
# azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# app-name: reportvision

deploy-services:
runs-on: ubuntu-latest
environment: dev2
needs: [build-frontend, environment-setup]
needs: [build-publish-ocr]
steps:
- uses: actions/checkout@v4
with:
name: frontend-tarball
- uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Deploy frontend
uses: ./.github/actions/deploy-frontend
# - name: Deploy frontend
# uses: ./.github/actions/deploy-frontend
# with:
# frontend-tarball: frontend.tgz
# deploy-env: dev2
- name: Deploy OCR-API
uses: ./.github/actions/deploy-api
with:
frontend-tarball: frontend.tgz
deploy-env: dev2
deploy-env: dev2
docker-tag: resusable-deploy-test-derek
docker-registry: ghcr.io
api-name: ocr-api

0 comments on commit 65f5836

Please sign in to comment.