From a532b652b49b3605639c4a1bd1230b1e66d5632e Mon Sep 17 00:00:00 2001 From: Vim <86254807+vim-usds@users.noreply.github.com> Date: Fri, 17 Sep 2021 11:52:27 -0700 Subject: [PATCH] Add env variable to set path prefix (#706) * Add env variable to set path prefix - When routing traffic to our new URL, the path prefix needs to be blank - adding path prefix to be set by env var to yml files * Update reference to env var in PATH_PREFIX * Update PR message URL with CDN - The actual website will point to the base url CDN --- .github/workflows/deploy_main.yml | 5 +++-- .github/workflows/deploy_staging.yml | 2 ++ client/gatsby-config.js | 2 +- client/src/components/zoomWarning.tsx | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy_main.yml b/.github/workflows/deploy_main.yml index 434e8ab4..5fdf5c6d 100644 --- a/.github/workflows/deploy_main.yml +++ b/.github/workflows/deploy_main.yml @@ -32,6 +32,7 @@ jobs: run: npm run build --if-present env: DATA_SOURCE: development + PATH_PREFIX: "" - name: Get directory contents run: ls -la public - name: Lint @@ -85,7 +86,7 @@ jobs: with: message: | **🚢 PR Deployed! 🚢** - Find it here: https://d2zjid6n5ja2pt.cloudfront.net/justice40-tool/${{env.DESTINATION_FOLDER}}/en/cejst/ ! + Find it here: https://d2zjid6n5ja2pt.cloudfront.net/ ! repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token-user-login: "github-actions[bot]" # The user.login for temporary GitHub tokens allow-repeats: false # This is the default @@ -93,4 +94,4 @@ jobs: run: | echo "Github pages: https://usds.github.io/justice40-tool/$DESTINATION_FOLDER/en" echo "Standard S3 bucket version (http only) : http://usds-geoplatform-justice40-website.s3-website-us-east-1.amazonaws.com/justice40-tool/$DESTINATION_FOLDER/en" - echo "Cloudfront https: https://d2zjid6n5ja2pt.cloudfront.net/justice40-tool/$DESTINATION_FOLDER/en" + echo "Cloudfront https: https://d2zjid6n5ja2pt.cloudfront.net" diff --git a/.github/workflows/deploy_staging.yml b/.github/workflows/deploy_staging.yml index 9f70f4d3..72ed6ad8 100644 --- a/.github/workflows/deploy_staging.yml +++ b/.github/workflows/deploy_staging.yml @@ -30,7 +30,9 @@ jobs: - name: Build run: npm run build --if-present env: + # Todo update this to env DATA_SOURCE: development + PATH_PREFIX: "/justice40-tool/${{env.DESTINATION_FOLDER}}" - name: Get directory contents run: ls -la public - name: Lint diff --git a/client/gatsby-config.js b/client/gatsby-config.js index f8ab423a..931d9de6 100644 --- a/client/gatsby-config.js +++ b/client/gatsby-config.js @@ -7,7 +7,7 @@ module.exports = { title: 'Justice40', image: '/static/favicon.ico', }, - pathPrefix: `/justice40-tool/${process.env.DESTINATION_FOLDER}`, + pathPrefix: `${process.env.PATH_PREFIX}`, plugins: [ { resolve: 'gatsby-plugin-sass', diff --git a/client/src/components/zoomWarning.tsx b/client/src/components/zoomWarning.tsx index d78c13eb..6b3e7646 100644 --- a/client/src/components/zoomWarning.tsx +++ b/client/src/components/zoomWarning.tsx @@ -8,6 +8,7 @@ interface IZoomWarningProps { zoomLevel: number } +// Update this file to trigger build const ZoomWarning = ({zoomLevel}: IZoomWarningProps) => { return ( <>