Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 不知道算不算是 Bug…… Github Actions 报错 #283

Open
Chocolateater opened this issue Oct 6, 2024 · 0 comments
Open

[Bug]: 不知道算不算是 Bug…… Github Actions 报错 #283

Chocolateater opened this issue Oct 6, 2024 · 0 comments

Comments

@Chocolateater
Copy link

使用的 AnZhiYu 版本? | What version of AnZhiYu are you use?

1.6.12

使用的浏览器? || What browse are you using?

Chrome

是否修改过主题文件? || Has the theme files been modified?

是 (Yes)

使用的系统? || What operating system are you using?

Windows

问题描述 | Describe the bug

运行 Github Actions 报错。提示 WARN No layout: 404/index.html ... (完整信息不放了,所有页面都没有 layout )

本地正常。其他主题(Landscape)不会出现此问题(当然因为 config.yml 没调会报错,但不会出现这个问题)

已经在 Issue 和 Discussion 查找,有一个类似情况 #231

已经仔细读过了,但我使用的是 npm 安装,themes 文件夹内无主题文件

Workflow 内容↓

name: Blog CI/CD # 脚本 workflow 名称

on:
  push:
    branches: [main, master] # 当监测 main,master 的 push
    paths: # 监测所有 source 目录下的文件变动,所有 yml,json 后缀文件的变动。
      - '*.json'
      - '**.yml'
      - '**/source/**'

jobs:
  blog: # 任务名称
    timeout-minutes: 30 # 设置 30 分钟超时
    runs-on: ubuntu-latest # 指定最新 ubuntu 系统
    steps:
      - uses: actions/checkout@v2 # 拉取仓库代码
      - uses: actions/setup-node@v2 # 设置 node.js 环境
      - name: Cache node_modules # 缓存 node_modules,提高编译速度,毕竟每月只有 2000 分钟。
        uses: actions/cache@v2 # 亲测 Github 服务器编译速度比我自己电脑都快,如果每次构建按5分钟计算,我们每个月可以免费部署 400 次,Github yyds!!!
        env:
          cache-name: cache-node-modules
        with:
          path: ~/.npm
          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-build-${{ env.cache-name }}-
            ${{ runner.os }}-build-
            ${{ runner.os }}-
      - name: Init Node.js # 安装源代码所需插件
        run: |
          npm install
          echo "init node successful"
      - name: Install Hexo-cli # 安装 Hexo
        run: |
          npm install -g hexo-cli --save
          echo "install hexo successful"

      - name: Install Anzhiyu Theme # 安装 Anzhiyu 主题
        run: |
          npm uninstall hexo-theme-anzhiyu
          npm install hexo-theme-anzhiyu
      - name: Build Blog # 编译创建静态博客文件
        run: |
          hexo clean
          hexo g
          echo "build blog successful"
      - name: Set up SSH
        run: |
          mkdir -p ~/.ssh
          echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
          chmod 600 ~/.ssh/id_rsa
          ssh-keyscan github.com >> ~/.ssh/known_hosts
      - name: Deploy Blog # 设置 git 信息并推送静态博客文件
        run: |
          git credential-cache exit
          git config --global user.name "Chocolateater"
          git config --global user.email "[email protected]"
          hexo deploy
      - run: echo "Deploy Successful!"

出现问题的网站 | Website

https://chocolateater.github.io/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant