Skip to content

lemonied/lemonied.github.io

Repository files navigation

Github Page

Install

yarn
# or
npx lerna bootstrap

Develop Blog

npm run dev
# or
yarn dev

Run Tasks

lerna.js

npx lerna run dev --scope=@lemonied/mtime

Dependencies

# Add
yarn workspace lemonied.github.io add typescript -D
# or
npx lerna add typescript --scope=blog --dev

# Remove
yarn workspace lemonied.github.io remove typescript

# Check for package updates
npm install npm-check-updates -g # install for global
ncu -t minor # Show all new dependencies(only update patch and minor)
ncu -t minor -u # upgrade package.json

Lint

npm run lint

Production

npm run build
# or
yarn build

And then, all static files of blog will be generated to blog/out directory

Deployment

以GitHub Pages为例

  1. User -> Settings -> Developer settings -> Personal access tokens -> Tokens (classic) 在这里生成一个token(需要有push权限),然后把token保存下来;
  2. Repository -> Settings -> Secrets and Variables -> Actions 点击 New repository secretNameTOKENSecret填刚才保存的token
  3. Repository -> Settings -> Environments,这里默认会有一个github-pages的环境,如果没有,则创建一个New environmentNamegithub-pages
  4. 接上一步点击github-pages -> Environment variables -> Add variable,依次添加环境变量:
    1. Name:CODE_GITHUB_REPOSITORY,Value:例 lemonied/lemonied.github.io.git,说明:编译完成后的静态文件需要推送的仓库(github仓库)
    2. Name:CODE_GITHUB_BRANCH,Value:例 blog,说明:编译完成后的静态文件需要推送的分支
    3. Name:SITE_URL,Value:例 https://www.lemonied.cn,说明:网站的url
    4. Name:USER_EMAIL,Value:例 chenjiyuan.super@gmail.com,说明:邮箱,用于推送时的git配置