From c3187c40cd2adedd5f628c23516c30bfdf38dc7e Mon Sep 17 00:00:00 2001 From: Administrator Date: Thu, 17 Oct 2024 11:08:27 -0600 Subject: [PATCH] try building and deploying frontend without env --- .github/actions/build-frontend/action.yml | 12 ++-- .github/workflows/deploy-dev.yml | 78 +++++++++++------------ 2 files changed, 41 insertions(+), 49 deletions(-) diff --git a/.github/actions/build-frontend/action.yml b/.github/actions/build-frontend/action.yml index 1c9ea9f2..0c6ac380 100644 --- a/.github/actions/build-frontend/action.yml +++ b/.github/actions/build-frontend/action.yml @@ -1,9 +1,6 @@ name: Build ReportVision's Front End description: Build the React application inputs: - deploy-env: - description: The environment being deployed (e.g. "prod" or "test") - required: true frontend-tarball: description: The path to the tar file containing the client code to deploy required: true @@ -16,13 +13,16 @@ inputs: api-endpoint: description: The endpoint to connect the frontend to an api required: true + node-version: + description: Node.js Version + required: true runs: using: composite steps: - uses: actions/setup-node@v4 with: - node-version: ${{ env.NODE_VERSION }} + node-version: ${{ inputs.node-version }} - name: Use cache for node_modules uses: actions/cache@v4 with: @@ -37,15 +37,11 @@ runs: - name: Build deployable frontend shell: bash working-directory: ${{ inputs.frontend-path }} - env: - DEPLOY_ENV: ${{ inputs.deploy-env }} run: | VITE_API_URL=${{ inputs.api-endpoint }} npm run build - name: Test frontend shell: bash working-directory: ${{ inputs.frontend-path }} - env: - DEPLOY_ENV: ${{ inputs.deploy-env }} run: | npm run test - name: Pack frontend into a tarball diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 66739ee0..e9b9bd76 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -26,42 +26,38 @@ permissions: attestations: write id-token: write -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: resusable-deploy-test-derek - 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 + + build-frontend: + runs-on: ubuntu-latest + 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 + frontend-path: ./frontend + frontend-build-path: ./frontend/dist/ + node-version: 20 # environment-setup: # runs-on: ubuntu-latest - # environment: dev2 + # environment: ${{ inputs.deploy-env }} # steps: # - uses: actions/checkout@v4 # - uses: azure/login@v2 @@ -72,8 +68,8 @@ jobs: # - uses: ./.github/actions/tf-setup # name: Setup this environment with Terraform # with: - # deploy-env: dev2 - # azure-resource-group: reportvision-rg-dev2 + # deploy-env: ${{ inputs.deploy-env }} + # azure-resource-group: reportvision-rg-${{ inputs.deploy-env }} # azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} # azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} # azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} @@ -82,7 +78,7 @@ jobs: deploy-services: runs-on: ubuntu-latest environment: dev2 - needs: [build-publish-ocr] + needs: [build-frontend] steps: - uses: actions/checkout@v4 - uses: azure/login@v2 @@ -90,15 +86,15 @@ jobs: 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 - # with: - # frontend-tarball: frontend.tgz - # deploy-env: dev2 - - name: Deploy OCR-API - uses: ./.github/actions/deploy-api + - name: Deploy frontend + uses: ./.github/actions/deploy-frontend with: + frontend-tarball: frontend.tgz deploy-env: dev2 - docker-tag: resusable-deploy-test-derek - docker-registry: ghcr.io - api-name: ocr-api \ No newline at end of file + # - name: Deploy OCR-API + # uses: ./.github/actions/deploy-api + # with: + # deploy-env: ${{ inputs.deploy-env }} + # docker-tag: ${{ inputs.ocr-version }} + # docker-registry: ghcr.io + # api-name: ocr-api \ No newline at end of file