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

使用Github Action自动部署渲染报错no layout #65

Open
bladedevoff opened this issue Sep 28, 2023 · 0 comments
Open

使用Github Action自动部署渲染报错no layout #65

bladedevoff opened this issue Sep 28, 2023 · 0 comments

Comments

@bladedevoff
Copy link

bladedevoff commented Sep 28, 2023

下面是我.github/workflows/autodeploy.yml中的内容

# 当有改动推送到master分支时,启动Action
name: 自动部署

on:
  push:
    branches:
      - main # 2020年10月后github新建仓库默认分支改为main,注意更改

  release:
    types:
      - published

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - name: 检查分支
      uses: actions/checkout@v2
      with:
        ref: main # 2020年10月后github新建仓库默认分支改为main,注意更改

    - name: 安装 Node
      uses: actions/setup-node@v1
      with:
        node-version: "18.x" #action使用的node版本,建议大版本和本地保持一致。可以在本地用node -v查询版本号。

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

    - name: 缓存 Hexo
      uses: actions/cache@v1
      id: cache
      with:
        path: node_modules
        key: ${{runner.OS}}-${{hashFiles('**/package-lock.json')}}

    - name: 安装依赖
      if: steps.cache.outputs.cache-hit != 'true'
      run: |
        npm install --save

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

    
    - name: 部署到Github
      uses: JamesIves/github-pages-deploy-action@v4
      with:
        token: ghp_tdvI3xOp***********************
        repository-name: richarpao/richarpao.github.io
        branch: main
        folder: public
        commit-message: "${{ github.event.head_commit.message }} Updated By VacuoleAutoDeploy"

gitignore中的内容

.DS_Store
Thumbs.db
db.json
*.log
node_modules/
public/
.deploy*/
.deploy_git*/
.idea
themes/Acrylic/.git

image

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