Manchester City Forever • Oasis Forever • Queen Forever • Manchester City Forever • Oasis Forever • Queen Forever • Manchester City Forever • Oasis Forever • Queen Forever • Manchester City Forever • Oasis Forever • Queen Forever • Manchester City Forever • Oasis Forever • Queen Forever • Manchester City Forever • Oasis Forever • Queen Forever • Manchester City Forever • Oasis Forever • Queen Forever • Manchester City Forever • Oasis Forever • Queen Forever •

1.准备工作

检查并更新,使得:

  • npm >v 9.3.1
  • Node >v 18.14

2. 克隆并完成初始化

git clone https://github.com/jackyzha0/quartz.git
cd quartz
npm i
npx quartz create

3. 部署笔记到本地

npx quartz build --serve

访问 http://localhost:8080/

4. 推送至 Github

git remote -v
 
git remote set-url origin REMOTE-URL
 
git remote add upstream https://github.com/jackyzha0/quartz.git
 
npx quartz sync --no-pull

5. 完成

5.1 创建文件

quartz/.github/workflows/ 路径下创建 deploy.yml 文件,内容如下:

name: Deploy Quartz site to GitHub Pages
 
on:
  push:
    branches:
      - v4
 
permissions:
  contents: read
  pages: write
  id-token: write
 
concurrency:
  group: "pages"
  cancel-in-progress: false
 
jobs:
  build:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0 # Fetch all history for git info
      - uses: actions/setup-node@v3
        with:
          node-version: 18.14
      - name: Install Dependencies
        run: npm ci
      - name: Build Quartz
        run: npx quartz build
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v2
        with:
          path: public
 
  deploy:
    needs: build
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v2

5.2 推送

每次更新笔记后,运行:

npx quartz sync

访问:“.github.io/`

参考资料:

  1. 官方教程
  2. 友站
  3. 视频教程