build: prototype #291
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to GitHub Pages | |
on: | |
push: | |
branches: [master] | |
jobs: | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录 | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
# 选择要使用的 node 版本 | |
node-version: "21" | |
# 缓存 node_modules | |
# - name: Cache dependencies | |
# uses: actions/cache@v3 | |
# id: yarn-cache | |
# with: | |
# path: | | |
# **/node_modules | |
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
# restore-keys: | | |
# ${{ runner.os }}-yarn- | |
# 如果缓存没有命中,安装依赖 | |
- name: Install dependencies | |
# if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: npm install | |
# run: yarn --frozen-lockfile | |
# 运行构建脚本 | |
- name: Build VuePress site | |
env: | |
NODE_OPTIONS: "--max_old_space_size=8192" | |
run: npm run docs:build | |
- name: Generate CNAME | |
run: cd ./docs/.vuepress/dist && echo 'neo.feyoudao.cn' > CNAME | |
- name: Generate nojekyll | |
run: cd ./docs/.vuepress/dist && echo > .nojekyll | |
# 查看 workflow 的文档来获取更多信息 | |
# @see https://github.com/crazy-max/ghaction-github-pages | |
- name: Deploy to GitHub Pages | |
uses: crazy-max/ghaction-github-pages@v2 | |
with: | |
repo: qqlcx5/vuepress-next | |
# 部署到 master 分支 | |
target_branch: dev | |
# 部署目录为 VuePress 的默认输出目录 | |
build_dir: docs/.vuepress/dist | |
env: | |
# @see https://docs.github.com/cn/actions/reference/authentication-in-a-workflow#about-the-github_token-secret | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
# Sync to Gitee | |
# - name: Sync to Gitee | |
# uses: wearerequired/git-mirror-action@master | |
# env: | |
# # 注意在 Settings->Secrets 配置 GITEE_RSA_PRIVATE_KEY | |
# SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} | |
# with: | |
# # 注意替换为你的 GitHub 源仓库地址 | |
# source-repo: [email protected]:qqlcx5/vuepress-next.git | |
# # 注意替换为你的 Gitee 目标仓库地址 | |
# destination-repo: [email protected]:qqlcx5/vuepress-next.git | |
# - name: Build Gitee Pages | |
# uses: yanglbme/gitee-pages-action@main | |
# with: | |
# # 注意替换为你的 Gitee 用户名 | |
# gitee-username: [email protected] | |
# # 注意在 Settings->Secrets 配置 GITEE_PASSWORD | |
# gitee-password: ${{ secrets.GITEE_PASSWORD }} | |
# # 注意替换为你的 Gitee 仓库路径,仓库路径名严格区分大小写,请准确填写,否则会出错 | |
# gitee-repo: qqlcx5/vuepress-next | |
# # 要部署的分支,默认是 master,若是其他分支,则需要指定(指定的分支必须存在) | |
# branch: dev | |
# name: Deploy to GitHub Pages | |
# on: | |
# push: | |
# branches: | |
# - master | |
# jobs: | |
# deploy-gh-pages: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# with: | |
# fetch-depth: 0 | |
# - name: Install pnpm | |
# uses: pnpm/action-setup@v2 | |
# with: | |
# version: 7 | |
# run_install: true | |
# - name: Setup Node.js | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: 16 | |
# cache: pnpm | |
# - name: Build project | |
# env: | |
# NODE_OPTIONS: --max_old_space_size=8192 | |
# run: pnpm run docs:build | |
# - name: Combine output | |
# run: | | |
# > dist/.nojekyll | |
# - name: Deploy | |
# uses: JamesIves/github-pages-deploy-action@v4 | |
# with: | |
# repository-name: vuepress-theme-hope/v2 | |
# branch: netlify | |
# folder: dist | |
# token: ${{ secrets.ACCESS_TOKEN }} | |
# single-commit: true |