volantis-x / hexo-theme-volantis

A Wonderful Theme for Hexo.
https://volantis.js.org
MIT License
2.02k stars 604 forks source link

【问题】:github action 部署后所有页面index内容为空 #896

Closed cunyu1943 closed 1 year ago

cunyu1943 commented 1 year ago

检查清单

主题版本

6.x

复现地址

https://github.com/cunyu1943/cunyu1943.github.io/blob/volantis

问题描述

image image

配置文件

name: 自动部署
# 当有改动推送到master分支时,启动Action
on:
  push:
    branches:
      - main
      # 2020年10月后github新建仓库默认分支改为main,注意更改
  release:
    types:
      - published

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: 检查分支
        uses: actions/checkout@v3
        with:
          ref: main

      - name: 安装 Node
        uses: actions/setup-node@v3
        with:
          node-version: latest

      - name: 安装 Hexo
        run: |
          export TZ='Asia/Shanghai'
          npm install hexo-cli -g

      - name: 缓存 Hexo
        id: cache-npm
        uses: actions/cache@v3
        env:
          cache-name: cache-node-modules
        with:
          path: node_modules
          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: 安装依赖
        if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
        run: |
          npm install --save

      - name: 生成静态文件
        run: |
          hexo clean
          hexo generate

      - name: 部署到Github
        uses: JamesIves/github-pages-deploy-action@v4.4.2
        with:
          token: ${{ secrets.TOKEN }}
          repository-name: username/repo
          branch: volantis
          folder: public
          commit-message: "${{ github.event.head_commit.message }}"

环境信息

image

No response

miRoox commented 1 year ago

我之前遇到过这样的问题,当时是node版本太低了。你换成16或者18试试?

cunyu1943 commented 1 year ago

node 版本就是 18 image

我之前遇到过这样的问题,当时是node版本太低了。你换成16或者18试试?

imjason commented 1 year ago

本地生成会有问题吗

cunyu1943 commented 1 year ago

本地生成会有问题吗

没有问题,后来换成 5.x 版本就好使了