Skip to content

Commit

Permalink
try building and deploying frontend without env
Browse files Browse the repository at this point in the history
  • Loading branch information
Administrator committed Oct 17, 2024
1 parent 84af21b commit c3187c4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 49 deletions.
12 changes: 4 additions & 8 deletions .github/actions/build-frontend/action.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down
78 changes: 37 additions & 41 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand All @@ -82,23 +78,23 @@ 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
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
# 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
# - 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

0 comments on commit c3187c4

Please sign in to comment.