This commit is contained in:
Zuoling Rong
2025-02-02 20:12:51 +08:00
parent 2b24915c9a
commit 7f74b412f2
2 changed files with 47 additions and 12 deletions

View File

@@ -11,6 +11,8 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: write
steps:
- name: Checkout repository
@@ -22,10 +24,23 @@ jobs:
node-version: '16'
- name: Install dependencies
run: npm install
run: |
npm install
if [ $? -ne 0 ]; then
echo "Failed to install dependencies"
exit 1
fi
- name: Generate site
run: node generator.js
run: |
node generator.js
if [ $? -ne 0 ]; then
echo "Failed to generate site"
exit 1
fi
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
@@ -33,3 +48,13 @@ jobs:
folder: .
branch: gh-pages
clean: true
- name: Enable GitHub Pages
run: |
gh api \
--method PUT \
-H "Accept: application/vnd.github+json" \
/repos/${{ github.repository }}/pages \
-f source='{"branch":"gh-pages","path":"/"}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -2,6 +2,8 @@
一个简洁美观的个人导航网站,帮助你整理和展示你的网络收藏。
[![部署状态](https://github.com/RZLNB/menav/actions/workflows/deploy.yml/badge.svg)](https://github.com/RZLNB/menav/actions/workflows/deploy.yml)
## 在线预览
访问:[https://rzlnb.github.io/menav/](https://rzlnb.github.io/menav/)
@@ -51,17 +53,25 @@ npm run generate
## 部署方式
### GitHub Pages 部署
### GitHub Pages 一键部署
注意GitHub Pages 在免费计划下只支持公开仓库。如果你需要保持仓库私有,建议:
- 升级到 GitHub Pro 或更高级的付费计划
- 或使用 Cloudflare Pages 部署(支持私有仓库)
只需三步即可完成部署:
部署步骤:
1. Fork 这个仓库
2. 修改你的配置
3. 推送到GitHub
4. 启用GitHub Pages选择 gh-pages 分支)
1. 点击右上角的 Fork 按钮,复制这个仓库到你的账号
2. 修改配置文件
- 打开 `config.yml` 文件
- 根据你的需求修改网站内容
- 提交更改
3. 等待自动部署
- 提交更改后GitHub Actions 会自动开始构建和部署
- 部署完成后,你可以通过 `https://你的用户名.github.io/menav` 访问你的网站
- 部署状态可以在仓库的 Actions 标签页查看
注意首次部署可能需要等待1-2分钟。如果遇到问题
- 确保仓库设置中的 Actions 权限已启用
- 检查仓库的 Actions 标签页中的部署日志
### Cloudflare Pages 部署