From e853f960149b91e6cf304913d967c3884ef9d30a Mon Sep 17 00:00:00 2001 From: melMass Date: Tue, 7 Nov 2023 15:56:51 +0100 Subject: [PATCH 1/6] =?UTF-8?q?ci=20=F0=9F=A4=96:=20the=20last=20brick=20t?= =?UTF-8?q?hat=20should=20make=20it=20work?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit :facepalm --- .github/workflows/pr-preview.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index bb3686d77..c873e2b08 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -14,7 +14,6 @@ on: - 'index.html' - 'vite.config.js' - concurrency: preview-${{ github.ref }} jobs: @@ -38,33 +37,33 @@ jobs: fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + deploy-preview: runs-on: ubuntu-latest needs: check_access if: needs.check_access.outputs.level == 'write' || needs.check_access.outputs.level == 'admin' - + strategy: matrix: node-version: [18] - + steps: - name: ⏬ Checkout uses: actions/checkout@v3 - + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org' cache: 'npm' - + - name: ⚙️ Install and Build run: | - export GH_BASE_URL="/teia-ui/previews/pr-${{ github.event.pull_request.number }}/" + echo "GH_BASE_URL="/teia-ui/previews/pr-${{ github.event.pull_request.number }}/" >> $GITHUB_ENV npm ci npm run build - + - name: Deploy preview uses: rossjrw/pr-preview-action@v1 with: From c7a35591643450911272931b90ccd31a87a56397 Mon Sep 17 00:00:00 2001 From: melMass Date: Tue, 7 Nov 2023 15:59:13 +0100 Subject: [PATCH 2/6] =?UTF-8?q?ci=20=F0=9F=A4=96:=20typo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index c873e2b08..e30278c7e 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -60,7 +60,7 @@ jobs: - name: ⚙️ Install and Build run: | - echo "GH_BASE_URL="/teia-ui/previews/pr-${{ github.event.pull_request.number }}/" >> $GITHUB_ENV + echo "GH_BASE_URL=/teia-ui/previews/pr-${{ github.event.pull_request.number }}/" >> $GITHUB_ENV npm ci npm run build From b18233a155b53b2829ec485b8349cdb88a60adb4 Mon Sep 17 00:00:00 2001 From: melMass Date: Tue, 7 Nov 2023 16:38:28 +0100 Subject: [PATCH 3/6] =?UTF-8?q?ci=20=F0=9F=A4=96:=20fingers=20crossed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - --- .github/workflows/pr-preview.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index e30278c7e..fe2212e59 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -60,9 +60,8 @@ jobs: - name: ⚙️ Install and Build run: | - echo "GH_BASE_URL=/teia-ui/previews/pr-${{ github.event.pull_request.number }}/" >> $GITHUB_ENV npm ci - npm run build + GH_BASE_URL="/teia-ui/previews/pr-${{ github.event.pull_request.number }}/" npm run build - name: Deploy preview uses: rossjrw/pr-preview-action@v1 From 523e36ec0dc35ff8cda3cfe86b617f9c50ed6d58 Mon Sep 17 00:00:00 2001 From: melMass Date: Tue, 7 Nov 2023 16:54:04 +0100 Subject: [PATCH 4/6] =?UTF-8?q?fix=20=F0=9F=90=9B:=20tell=20the=20router?= =?UTF-8?q?=20about=20base=5Furl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this is set to "/" in prod --- src/index.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.jsx b/src/index.jsx index f0cc5d5f3..21ebc449e 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -146,7 +146,10 @@ const router = createBrowserRouter( {display_routes} - ) + ), + { + basename: import.meta.env.BASE_URL, + } ) ReactDOM.createRoot(document.getElementById('root')).render( From 23cf89aafb1d325156180067a28700d155c0dc2f Mon Sep 17 00:00:00 2001 From: melMass Date: Tue, 7 Nov 2023 17:03:13 +0100 Subject: [PATCH 5/6] =?UTF-8?q?revert=20=E2=8F=AA:=20uneeded=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the export is actually used only inside the context so it's fine --- .github/workflows/pr-preview.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index fe2212e59..c9c763b22 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -60,8 +60,9 @@ jobs: - name: ⚙️ Install and Build run: | + export GH_BASE_URL="/teia-ui/previews/pr-${{ github.event.pull_request.number }}/" npm ci - GH_BASE_URL="/teia-ui/previews/pr-${{ github.event.pull_request.number }}/" npm run build + npm run build - name: Deploy preview uses: rossjrw/pr-preview-action@v1 From dbecf027a2d8c9e44c672b8e993a65308ad5e516 Mon Sep 17 00:00:00 2001 From: melMass Date: Tue, 7 Nov 2023 17:19:22 +0100 Subject: [PATCH 6/6] =?UTF-8?q?wip=20=F0=9F=9A=A7:=20use=20the=20hashroute?= =?UTF-8?q?r=20on=20gh=20pages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.jsx b/src/index.jsx index 21ebc449e..518f9759a 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -52,6 +52,7 @@ import { Terms } from '@pages/terms' import ReactDOM from 'react-dom/client' import { createBrowserRouter, + createHashRouter, createRoutesFromElements, Route, RouterProvider, @@ -73,7 +74,10 @@ const display_routes = ( ) //TODO(mel): Check/Update site map / robot.txt -const router = createBrowserRouter( + +const routerCreator = + import.meta.env.BASE_URL === '/' ? createBrowserRouter : createHashRouter +const router = routerCreator( createRoutesFromElements( } element={}> } />