首先fork此项目https://github.com/YYsuni/2025-blog-public,我fork后,得到的项目地址是https://github.com/brightmann/2bp,
然后,访问vercel.com/new ,导入项目https://github.com/brightmann/2bp
Build Command栏填入pnpm build
Install Command栏填入pnpm install
然后点击底部的deploy按钮,等待部署完成。部署完成后,我得到网址:
https://2bp-tan.vercel.app/
新建源帖:
首先 创建 Github App,
在 github 个人设置 https://github.com/settings/profile里面,点击左下角的developer settings- https://github.com/settings/apps, 然后点击 New Github App- https://github.com/settings/apps/new ,给GitHub App name取个名字。Homepage URL , 输入什么都不影响, 就设置为你的仓库地址好了,我设置为https://github.com/brightmann/2bp。取消Webhook的下一行的Active复选框。
在 Permissions->Repository permissions->contents的access权限选择read and write.其它项的权限不要修改。
Where can this GitHub App be installed? 选择
点击create github app.
创建密钥
创建好 Github App 后会提示必须创建一个 Private Key,直接创建,会自动下载(不见了也不要紧,后面自己再创建再下载就行)。页面上有个 App ID 需要复制一下.
然后点击左侧的install app, 在跳转到的页面里,点击install按钮。
点击install,就完成了 Github App 管理该仓库的权限设置.
然后修改仓库文件 src/consts.ts (https://github.com/brightmann/2bp/blob/main/src/consts.ts,修改第11/12/14行)以设置环境变量。
设置完成后,需要手动再部署一次,让环境变量生效。
现在访问 https://2bp-tan.vercel.app/blog,右上角会出现‘编辑’字样:
点击‘编辑’,‘编辑’会变成‘导入密匙’:
然后点击‘导入密匙’,定位到上面下载的private key文件,然后点击‘保存’按钮。然后访问博客的首页https://2bp-tan.vercel.app/,页面的右上角会出现‘写文章’按钮:
点击‘写文章’按钮,就会出现编辑文章的页面:
写标题,slug的值,以及文章内容(支持html codes),然后点击‘导入密匙’,定位到上面下载的密匙文件,然后https://2bp-tan.vercel.app/write的右上角就出现了‘发布’按钮。点击‘发布’按钮,稍等2分钟,博客网站就会更新(就会出现刚写的文章)。
项目地址:
https://github.com/YYsuni/2025-blog-public
https://github.com/brightmann/2bp
演示博客:
https://2bp-tan.vercel.app/




No comments:
Post a Comment