Skip to content

Commit 4fe8342

Browse files
committed
fix: enable workflow
1 parent 60c02e3 commit 4fe8342

File tree

1 file changed

+47
-19
lines changed

1 file changed

+47
-19
lines changed

.github/workflows/deploy.yml

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,67 @@
1-
name: Deploy Website
1+
name: Deploy Hexo site to Pages
22

33
on:
4+
# Runs on pushes targeting the `master` branch
45
push:
5-
branches:
6-
- main
6+
branches: [master]
7+
8+
# Allows manual trigger from the Actions tab
9+
workflow_dispatch:
10+
11+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# Allow only one concurrent deployment, skipping queued runs
18+
concurrency:
19+
group: pages
20+
cancel-in-progress: false
721

822
jobs:
9-
build-and-deploy:
23+
# Build job
24+
build:
1025
runs-on: ubuntu-latest
11-
1226
steps:
13-
# 检出代码
14-
- name: Checkout code
15-
uses: actions/checkout@v3
27+
# Check out the code
28+
- name: Checkout
29+
uses: actions/checkout@v4
1630

17-
# 设置 Node.js 环境
18-
- name: Setup Node.js
19-
uses: actions/setup-node@v3
31+
# Set up Node.js environment
32+
- name: Setup Node
33+
uses: actions/setup-node@v4
2034
with:
2135
node-version: 'lts/*'
36+
cache: npm
2237

23-
# 安装依赖
38+
# Install dependencies
2439
- name: Install dependencies
2540
run: |
2641
npm install
42+
npm install -g hexo-cli
2743
npm install hexo-theme-stellar
2844
npm audit fix
2945
30-
# 生成静态文件
31-
- name: Generate static files
46+
# Generate static files with Hexo
47+
- name: Build with Hexo
3248
run: hexo generate
3349

34-
# 部署到 GitHub Pages
35-
- name: Deploy to GitHub Pages
36-
uses: peaceiris/actions-gh-pages@v3
50+
# Upload artifact
51+
- name: Upload artifact
52+
uses: actions/upload-pages-artifact@v3
3753
with:
38-
github_token: ${{ secrets.GITHUB_TOKEN }}
39-
publish_dir: ./public
54+
path: ./public
55+
56+
# Deployment job
57+
deploy:
58+
environment:
59+
name: github-pages
60+
url: ${{ steps.deployment.outputs.page_url }}
61+
needs: build
62+
runs-on: ubuntu-latest
63+
name: Deploy
64+
steps:
65+
- name: Deploy to GitHub Pages
66+
id: deployment
67+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)