From 38ea6b1a4088485965c9242516fadd7ee7c6492c Mon Sep 17 00:00:00 2001 From: Yogesh Choudhary Paliyal Date: Sun, 11 Aug 2024 17:18:26 +0530 Subject: [PATCH] PR deploy testing Fixes #34 Add GitHub Action to deploy PR on GitHub Pages. * **Update `src/App.tsx`** - Change `BrowserRouter` `basename` prop to use `process.env.PUBLIC_URL`. * **Modify `.github/workflows/pr-check.yml`** - Add permissions for `pages: write` and `id-token: write`. - Add step to set up Pages using `actions/configure-pages@v4`. - Add step to upload artifact using `actions/upload-pages-artifact@v3`. - Add step to deploy to GitHub Pages using `actions/deploy-pages@v4`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/TechPaliyal/LibraryManagement/issues/34?shareId=XXXX-XXXX-XXXX-XXXX). --- .github/workflows/pr-check.yml | 12 +++++++++++- src/App.tsx | 3 +-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 20cb768..e497308 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -7,6 +7,8 @@ on: # Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages permissions: contents: read + pages: write + id-token: write # Allow one concurrent deployment concurrency: @@ -28,4 +30,12 @@ jobs: run: npm ci - name: Build run: npm run build - + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: './dist' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/src/App.tsx b/src/App.tsx index 0636f08..2a72162 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,3 @@ - import './App.css' import LoginForm from './Pages/LoginForm/LoginForm'; import Register from './Pages/register/Register'; @@ -9,7 +8,7 @@ import Users from './Pages/Users'; function App() { return ( - + } /> } />