Skip to content

Commit c20bf26

Browse files
authored
Create main.yml
1 parent 855b9f9 commit c20bf26

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Deploy Vite React App to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
```
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 20
25+
26+
- name: Install dependencies
27+
run: npm install
28+
29+
- name: Build
30+
run: npm run build
31+
32+
- name: Upload artifact
33+
uses: actions/upload-pages-artifact@v3
34+
with:
35+
path: ./dist
36+
```
37+
38+
deploy:
39+
needs: build
40+
runs-on: ubuntu-latest
41+
42+
```
43+
environment:
44+
name: github-pages
45+
url: ${{ steps.deployment.outputs.page_url }}
46+
47+
steps:
48+
- name: Deploy to GitHub Pages
49+
id: deployment
50+
uses: actions/deploy-pages@v4
51+
```

0 commit comments

Comments
 (0)