-
Notifications
You must be signed in to change notification settings - Fork 98
45 lines (38 loc) · 1.15 KB
/
deploy.yml
File metadata and controls
45 lines (38 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git" HEAD:master