Skip to content

Commit 1c1a423

Browse files
Copilotrenbaoshuo
andauthored
Add GitHub Actions workflow for deploying to GitHub Pages (#6)
--------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: renbaoshuo <[email protected]>
1 parent e9d99f1 commit 1c1a423

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

.github/workflows/deploy.yml

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

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,28 @@ npm run build # Build the project
1717
npm run preview # Preview the production build
1818
```
1919

20+
## Deployment
21+
22+
This project is configured to automatically deploy to GitHub Pages when changes are pushed to the `main` branch.
23+
24+
### Setup Instructions
25+
26+
To enable GitHub Pages deployment:
27+
28+
1. Go to your repository **Settings****Pages**
29+
2. Under **Source**, select **GitHub Actions**
30+
3. The workflow will automatically run on every push to the `main` branch
31+
32+
The site will be available at: `https://<username>.github.io/<repository-name>/`
33+
34+
### Manual Deployment
35+
36+
You can also trigger a deployment manually:
37+
38+
1. Go to **Actions** tab in your repository
39+
2. Select the **Deploy to GitHub Pages** workflow
40+
3. Click **Run workflow**
41+
2042
## Author
2143

2244
**FzuHelper Website** © [Baoshuo](https://github.com/renbaoshuo).<br>

0 commit comments

Comments
 (0)