Skip to content

Commit a9c0eac

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

File tree

2 files changed

+30
-26
lines changed

2 files changed

+30
-26
lines changed

.github/workflows/deploy.yml

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

33
on:
4+
# Trigger the workflow every time you push to the `main` branch
5+
# Using a different branch name? Replace `main` with your branch’s name
46
push:
5-
branches:
6-
- main
7+
branches: [main]
8+
# Allows you to run this workflow manually from the Actions tab on GitHub.
9+
workflow_dispatch:
10+
11+
# Allow this job to clone the repo and create a page deployment
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
716

817
jobs:
9-
deploy:
18+
build:
1019
runs-on: ubuntu-latest
1120
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 # 确保这是你的构建输出目录
21+
- name: Checkout your repository using git
22+
uses: actions/checkout@v4
23+
- name: Install, build, and upload your site output
24+
uses: withastro/action@v4
25+
# with:
26+
# path: . # The root location of your Astro project inside the repository. (optional)
27+
# node-version: 22 # The specific version of Node that should be used to build your site. Defaults to 22. (optional)
28+
# package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
3029

30+
deploy:
31+
needs: build
32+
runs-on: ubuntu-latest
33+
environment:
34+
name: github-pages
35+
url: ${{ steps.deployment.outputs.page_url }}
36+
steps:
3137
- name: Deploy to GitHub Pages
32-
uses: peaceiris/actions-gh-pages@v3
33-
with:
34-
github_token: ${{ secrets.GITHUB_TOKEN }}
35-
publish_dir: ./dist # 确保这是你的构建输出目录
38+
id: deployment
39+
uses: actions/deploy-pages@v4

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: "/",
25+
base: "/westenblog",
2626
trailingSlash: "always",
2727
integrations: [
2828
tailwind(

0 commit comments

Comments
 (0)