Skip to content

Commit 2871df1

Browse files
committed
feat: update deploy
1 parent 5576ebc commit 2871df1

File tree

2 files changed

+26
-30
lines changed

2 files changed

+26
-30
lines changed

.github/workflows/deploy.yml

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,35 @@
11
name: Deploy to GitHub Pages
22

33
on:
4-
# 每次推送到 `main` 分支时触发这个“工作流程”
5-
# 如果你使用了别的分支名,请按需将 `main` 替换成你的分支名
64
push:
7-
branches: [ main ]
8-
# 允许你在 GitHub 上的 Actions 标签中手动触发此“工作流程”
9-
workflow_dispatch:
10-
11-
# 允许 job 克隆 repo 并创建一个 page deployment
12-
permissions:
13-
contents: read
14-
pages: write
15-
id-token: write
5+
branches:
6+
- main
167

178
jobs:
18-
build:
19-
runs-on: ubuntu-latest
20-
steps:
21-
- name: Checkout your repository using git
22-
uses: actions/checkout@v4
23-
- name: Install, build, and upload your site
24-
uses: withastro/action@v3
25-
# with:
26-
# path: . # 存储库中 Astro 项目的根位置。(可选)
27-
# node-version: 20 # 用于构建站点的特定 Node.js 版本,默认为 20。(可选)
28-
# package-manager: pnpm@latest # 应使用哪个 Node.js 包管理器来安装依赖项和构建站点。会根据存储库中的 lockfile 自动检测。(可选)
29-
309
deploy:
31-
needs: build
3210
runs-on: ubuntu-latest
33-
environment:
34-
name: github-pages
35-
url: ${{ steps.deployment.outputs.page_url }}
3611
steps:
12+
- name: Checkout Repository
13+
uses: actions/checkout@v3
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: '22'
19+
20+
- name: Install Dependencies
21+
run: pnpm install
22+
23+
- name: Build Project
24+
run: pnpm build
25+
26+
- name: Upload Pages Artifact
27+
uses: actions/upload-pages-artifact@v3
28+
with:
29+
path: ./dist # 确保这是你的构建输出目录
30+
3731
- name: Deploy to GitHub Pages
38-
id: deployment
39-
uses: actions/deploy-pages@v4
32+
uses: peaceiris/actions-gh-pages@v3
33+
with:
34+
github_token: ${{ secrets.GITHUB_TOKEN }}
35+
publish_dir: ./dist # 确保这是你的构建输出目录

astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { remarkReadingTime } from "./src/plugins/remark-reading-time.mjs";
2222
// https://astro.build/config
2323
export default defineConfig({
2424
site: "https://westenwang.github.io/",
25-
base: "/blog",
25+
base: "/",
2626
trailingSlash: "always",
2727
integrations: [
2828
tailwind(

0 commit comments

Comments
 (0)