From 843af7fd5aa5b7a03b76ba5882f94bf5c095d9fc Mon Sep 17 00:00:00 2001 From: siddheshraze <81591724+siddheshraze@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:16:26 -0400 Subject: [PATCH] still getting build errors --- .github/workflows/temp-forestgeo-livesite.yml | 124 +++++++++++++----- 1 file changed, 92 insertions(+), 32 deletions(-) diff --git a/.github/workflows/temp-forestgeo-livesite.yml b/.github/workflows/temp-forestgeo-livesite.yml index b3e9e172..f1dd7370 100644 --- a/.github/workflows/temp-forestgeo-livesite.yml +++ b/.github/workflows/temp-forestgeo-livesite.yml @@ -13,6 +13,26 @@ jobs: if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest environment: production + env: + AZURE_AD_CLIENT_SECRET_PRODUCTION: ${{ secrets.AZURE_AD_CLIENT_SECRET_PRODUCTION }} + AZURE_AD_CLIENT_ID_PRODUCTION: ${{ secrets.AZURE_AD_CLIENT_ID_PRODUCTION }} + AZURE_AD_TENANT_ID_PRODUCTION: ${{ secrets.AZURE_AD_TENANT_ID_PRODUCTION }} + NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }} + NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }} + AZURE_SQL_USER: ${{ secrets.AZURE_SQL_USER }} + AZURE_SQL_PASSWORD: ${{ secrets.AZURE_SQL_PASSWORD }} + AZURE_SQL_SERVER: ${{ secrets.AZURE_SQL_SERVER }} + AZURE_SQL_DATABASE: ${{ secrets.AZURE_SQL_DATABASE }} + AZURE_SQL_PORT: ${{ secrets.AZURE_SQL_PORT }} + AZURE_STORAGE_SAS_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_SAS_CONNECTION_STRING }} + AZURE_SQL_SCHEMA: ${{ secrets.AZURE_SQL_SCHEMA }} + AZURE_SQL_CATALOG_SCHEMA: ${{ secrets.AZURE_SQL_CATALOG_SCHEMA }} + AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }} + NODE_ENV: production + PORT: 3000 + FG_PAT: ${{ secrets.FG_PAT }} + OWNER: ${{ secrets.OWNER }} + REPO: ${{ secrets.REPO }} steps: - uses: actions/checkout@v4 @@ -22,9 +42,40 @@ jobs: with: node-version: '18.x' + - name: create env file (in frontend/ directory) -- production + id: create-env-file-prod + if: github.ref == 'refs/heads/main' + run: | + touch frontend/.env + echo AZURE_AD_CLIENT_SECRET_PRODUCTION=${{ secrets.AZURE_AD_CLIENT_SECRET_PRODUCTION }} >> frontend/.env + echo AZURE_AD_CLIENT_ID_PRODUCTION=${{ secrets.AZURE_AD_CLIENT_ID_PRODUCTION }} >> frontend/.env + echo AZURE_AD_TENANT_ID_PRODUCTION=${{ secrets.AZURE_AD_TENANT_ID_PRODUCTION }} >> frontend/.env + echo NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }} >> frontend/.env + echo NEXTAUTH_URL=${{ secrets.NEXTAUTH_URL }} >> frontend/.env + echo AZURE_SQL_USER=${{ secrets.AZURE_SQL_USER }} >> frontend/.env + echo AZURE_SQL_PASSWORD=${{ secrets.AZURE_SQL_PASSWORD }} >> frontend/.env + echo AZURE_SQL_SERVER=${{ secrets.AZURE_SQL_SERVER }} >> frontend/.env + echo AZURE_SQL_DATABASE=${{ secrets.AZURE_SQL_DATABASE }} >> frontend/.env + echo AZURE_SQL_PORT=${{ secrets.AZURE_SQL_PORT }} >> frontend/.env + echo AZURE_STORAGE_SAS_CONNECTION_STRING=${{ secrets.AZURE_STORAGE_SAS_CONNECTION_STRING }} >> frontend/.env + echo AZURE_SQL_SCHEMA=${{ secrets.AZURE_SQL_SCHEMA }} >> frontend/.env + echo AZURE_SQL_CATALOG_SCHEMA=${{ secrets.AZURE_SQL_CATALOG_SCHEMA }} >> frontend/.env + echo AZURE_STORAGE_CONNECTION_STRING=${{ secrets.AZURE_STORAGE_CONNECTION_STRING }} >> frontend/.env + echo NODE_ENV=production >> frontend/.env + echo PORT=3000 >> frontend/.env + echo FG_PAT=${{ secrets.FG_PAT }} >> frontend/.env + echo OWNER=${{ secrets.OWNER }} >> frontend/.env + echo REPO=${{ secrets.REPO }} >> frontend/.env + - name: Write Certificate to File run: | echo "${{ secrets.CERTIFICATE }}" > frontend/DigiCertGlobalRootCA.crt.pem + + - name: check env vars + run: printenv | grep AZURE + + - name: check node env + run: echo "NODE_ENV is $NODE_ENV" - name: Cache node modules uses: actions/cache@v2 @@ -62,12 +113,17 @@ jobs: name: app-build path: frontend/build/standalone + # Development Job (runs on forestgeo-app-* branches) + build-app-development: + if: startsWith(github.ref, 'refs/heads/forestgeo-app-') + runs-on: ubuntu-latest + environment: development env: - AZURE_AD_CLIENT_SECRET_PRODUCTION: ${{ secrets.AZURE_AD_CLIENT_SECRET_PRODUCTION }} - AZURE_AD_CLIENT_ID_PRODUCTION: ${{ secrets.AZURE_AD_CLIENT_ID_PRODUCTION }} - AZURE_AD_TENANT_ID_PRODUCTION: ${{ secrets.AZURE_AD_TENANT_ID_PRODUCTION }} + AZURE_AD_CLIENT_SECRET_DEVELOPMENT: ${{ secrets.AZURE_AD_CLIENT_SECRET_DEVELOPMENT }} + AZURE_AD_CLIENT_ID_DEVELOPMENT: ${{ secrets.AZURE_AD_CLIENT_ID_DEVELOPMENT }} + AZURE_AD_TENANT_ID_DEVELOPMENT: ${{ secrets.AZURE_AD_TENANT_ID_DEVELOPMENT }} NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }} - NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }} + NEXTAUTH_URL: ${{ secrets.NEXTAUTH_DEV_URL }} AZURE_SQL_USER: ${{ secrets.AZURE_SQL_USER }} AZURE_SQL_PASSWORD: ${{ secrets.AZURE_SQL_PASSWORD }} AZURE_SQL_SERVER: ${{ secrets.AZURE_SQL_SERVER }} @@ -77,18 +133,12 @@ jobs: AZURE_SQL_SCHEMA: ${{ secrets.AZURE_SQL_SCHEMA }} AZURE_SQL_CATALOG_SCHEMA: ${{ secrets.AZURE_SQL_CATALOG_SCHEMA }} AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }} - NODE_ENV: production + NODE_ENV: development PORT: 3000 FG_PAT: ${{ secrets.FG_PAT }} OWNER: ${{ secrets.OWNER }} REPO: ${{ secrets.REPO }} - # Development Job (runs on forestgeo-app-* branches) - build-app-development: - if: startsWith(github.ref, 'refs/heads/forestgeo-app-') - runs-on: ubuntu-latest - environment: development - steps: - uses: actions/checkout@v4 @@ -97,10 +147,41 @@ jobs: with: node-version: '18.x' + - name: create env file (in frontend/ directory) -- development + id: create-env-file-dev + if: startsWith(github.ref, 'refs/heads/forestgeo-app-') + run: | + touch frontend/.env + echo AZURE_AD_CLIENT_SECRET_DEVELOPMENT=${{ secrets.AZURE_AD_DEVELOPMENT_CLIENT_SECRET_DEVELOPMENT }} >> frontend/.env + echo AZURE_AD_CLIENT_ID_DEVELOPMENT=${{ secrets.AZURE_AD_DEVELOPMENT_CLIENT_ID_DEVELOPMENT }} >> frontend/.env + echo AZURE_AD_TENANT_ID_DEVELOPMENT=${{ secrets.AZURE_AD_DEVELOPMENT_TENANT_ID_DEVELOPMENT }} >> frontend/.env + echo NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }} >> frontend/.env + echo NEXTAUTH_URL=${{ secrets.NEXTAUTH_DEV_URL }} >> frontend/.env + echo AZURE_SQL_USER=${{ secrets.AZURE_SQL_USER }} >> frontend/.env + echo AZURE_SQL_PASSWORD=${{ secrets.AZURE_SQL_PASSWORD }} >> frontend/.env + echo AZURE_SQL_SERVER=${{ secrets.AZURE_SQL_SERVER }} >> frontend/.env + echo AZURE_SQL_DATABASE=${{ secrets.AZURE_SQL_DATABASE }} >> frontend/.env + echo AZURE_SQL_PORT=${{ secrets.AZURE_SQL_PORT }} >> frontend/.env + echo AZURE_STORAGE_SAS_CONNECTION_STRING=${{ secrets.AZURE_STORAGE_SAS_CONNECTION_STRING }} >> frontend/.env + echo AZURE_SQL_SCHEMA=${{ secrets.AZURE_SQL_SCHEMA }} >> frontend/.env + echo AZURE_SQL_CATALOG_SCHEMA=${{ secrets.AZURE_SQL_CATALOG_SCHEMA }} >> frontend/.env + echo AZURE_STORAGE_CONNECTION_STRING=${{ secrets.AZURE_STORAGE_CONNECTION_STRING }} >> frontend/.env + echo NODE_ENV=development >> frontend/.env + echo PORT=3000 >> frontend/.env + echo FG_PAT=${{ secrets.FG_PAT }} >> frontend/.env + echo OWNER=${{ secrets.OWNER }} >> frontend/.env + echo REPO=${{ secrets.REPO }} >> frontend/.env + - name: Write Certificate to File run: | echo "${{ secrets.CERTIFICATE }}" > frontend/DigiCertGlobalRootCA.crt.pem + - name: check env vars + run: printenv | grep AZURE + + - name: check node env + run: echo "NODE_ENV is $NODE_ENV" + - name: Cache node modules uses: actions/cache@v2 with: @@ -137,27 +218,6 @@ jobs: name: app-build path: frontend/build/standalone - env: - AZURE_AD_CLIENT_SECRET_DEVELOPMENT: ${{ secrets.AZURE_AD_CLIENT_SECRET_DEVELOPMENT }} - AZURE_AD_CLIENT_ID_DEVELOPMENT: ${{ secrets.AZURE_AD_CLIENT_ID_DEVELOPMENT }} - AZURE_AD_TENANT_ID_DEVELOPMENT: ${{ secrets.AZURE_AD_TENANT_ID_DEVELOPMENT }} - NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }} - NEXTAUTH_URL: ${{ secrets.NEXTAUTH_DEV_URL }} - AZURE_SQL_USER: ${{ secrets.AZURE_SQL_USER }} - AZURE_SQL_PASSWORD: ${{ secrets.AZURE_SQL_PASSWORD }} - AZURE_SQL_SERVER: ${{ secrets.AZURE_SQL_SERVER }} - AZURE_SQL_DATABASE: ${{ secrets.AZURE_SQL_DATABASE }} - AZURE_SQL_PORT: ${{ secrets.AZURE_SQL_PORT }} - AZURE_STORAGE_SAS_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_SAS_CONNECTION_STRING }} - AZURE_SQL_SCHEMA: ${{ secrets.AZURE_SQL_SCHEMA }} - AZURE_SQL_CATALOG_SCHEMA: ${{ secrets.AZURE_SQL_CATALOG_SCHEMA }} - AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }} - NODE_ENV: development - PORT: 3000 - FG_PAT: ${{ secrets.FG_PAT }} - OWNER: ${{ secrets.OWNER }} - REPO: ${{ secrets.REPO }} - deploy-app: needs: [build-app-production, build-app-development] runs-on: ubuntu-latest