Skip to content

修改 Github 自动化失败的问题 #2

修改 Github 自动化失败的问题

修改 Github 自动化失败的问题 #2

Workflow file for this run

name: Deploy Hexo Blog
on:
push:
branches:
- hexo # 当推送到 hexo 分支时触发
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write # 授予写权限以便推送到 master 分支
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: hexo
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '16' # 使用 Node.js 16,兼容 Hexo 5.x
- name: Install Dependencies
run: |
npm install hexo-cli -g
npm install
- name: Build Hexo
run: |
hexo clean
hexo generate
- name: Deploy to GitHub Pages
run: |
cd ./public
git init
git config user.name "blinkfox"
git config user.email "1181062873@qq.com"
git add .
git commit -m "Auto update docs by GitHub Actions"
git push --force --quiet "https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" HEAD:master