diff --git a/.github/actions/deploy-api/action.yml b/.github/actions/deploy-api/action.yml new file mode 100644 index 00000000..786e6a1e --- /dev/null +++ b/.github/actions/deploy-api/action.yml @@ -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 }}' \ No newline at end of file diff --git a/.github/actions/deploy-backend/action.yml b/.github/actions/deploy-backend/action.yml deleted file mode 100644 index e69de29b..00000000 diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index fcc4fef9..3f03420a 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -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 \ No newline at end of file + deploy-env: dev2 + docker-tag: resusable-deploy-test-derek + docker-registry: ghcr.io + api-name: ocr-api \ No newline at end of file