Skip to content

Commit f3ea4cf

Browse files
committed
chore: add GitHub Pages deploy workflow and set site URL
1 parent 9a58f0f commit f3ea4cf

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

‎.github/workflows/deploy.yml‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
# 每次 push 到 main 分支时触发
5+
push:
6+
branches: [main]
7+
# 允许在 GitHub 的 Actions 页面手动触发
8+
workflow_dispatch:
9+
10+
# 允许该 job 克隆仓库并创建 Pages 部署
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout your repository using git
21+
uses: actions/checkout@v7
22+
- name: Install, build, and upload your site
23+
uses: withastro/action@v6
24+
25+
deploy:
26+
needs: build
27+
runs-on: ubuntu-latest
28+
environment:
29+
name: github-pages
30+
url: ${{ steps.deployment.outputs.page_url }}
31+
steps:
32+
- name: Deploy to GitHub Pages
33+
id: deployment
34+
uses: actions/deploy-pages@v5

‎astro.config.mjs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { defineConfig, fontProviders } from 'astro/config';
66

77
// https://astro.build/config
88
export default defineConfig({
9-
site: 'https://example.com',
9+
// 仓库名匹配 <username>.github.io,因此不需要配置 base
10+
site: 'https://kingpython123.github.io',
1011
integrations: [mdx(), sitemap()],
1112
fonts: [
1213
{

0 commit comments

Comments
 (0)