Skip to content

Commit 37ca034

Browse files
second commit
1 parent b24f258 commit 37ca034

4 files changed

Lines changed: 196 additions & 1 deletion

File tree

.github/workflows/cd.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy React App to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
build-and-deploy:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 18
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Build the project
27+
run: npm run build
28+
29+
- name: Configure Git identity
30+
run: |
31+
git config --global user.name "username(github)"
32+
git config --global user.email "email(github)"
33+
34+
- name: Authenticate and deploy to GitHub Pages
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
run: |
38+
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
39+
npm run deploy

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: React CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '18'
21+
22+
- name: npm ci
23+
run: npm ci
24+
25+
- name: Install dependencies
26+
run: npm install vite@latest
27+
28+
- name: Run tests
29+
run: npm test --if-present
30+
31+
- name: Build project
32+
run: npm run build --if-present

package-lock.json

Lines changed: 120 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
"name": "myapp",
33
"version": "0.1.0",
44
"private": true,
5+
"Homepage": "/FSAD-S104/",
56
"dependencies": {
67
"@testing-library/dom": "^10.4.1",
78
"@testing-library/jest-dom": "^6.6.4",
89
"@testing-library/react": "^16.3.0",
910
"@testing-library/user-event": "^13.5.0",
11+
"gh-pages": "^6.3.0",
1012
"react": "^19.1.1",
1113
"react-dom": "^19.1.1",
1214
"react-scripts": "5.0.1",
@@ -16,7 +18,9 @@
1618
"start": "react-scripts start",
1719
"build": "react-scripts build",
1820
"test": "react-scripts test",
19-
"eject": "react-scripts eject"
21+
"eject": "react-scripts eject",
22+
"predeploy": "npm run build",
23+
"deploy": "gh-pages -d build"
2024
},
2125
"eslintConfig": {
2226
"extends": [

0 commit comments

Comments
 (0)