Skip to content

Commit

Permalink
PR deploy testing
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
yogeshpaliyal committed Aug 11, 2024
1 parent cbed86a commit 38ea6b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
3 changes: 1 addition & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import './App.css'
import LoginForm from './Pages/LoginForm/LoginForm';
import Register from './Pages/register/Register';
Expand All @@ -9,7 +8,7 @@ import Users from './Pages/Users';

function App() {
return (
<BrowserRouter basename="/LibraryManagement">
<BrowserRouter basename={process.env.PUBLIC_URL}>
<Routes>
<Route path="/" element={<LandingPage />} />
<Route path="/library/login" element={<LoginForm up='library'/>} />
Expand Down

0 comments on commit 38ea6b1

Please sign in to comment.