Skip to content

Commit 57bb05a

Browse files
committed
ci: 添加GitHub Pages部署配置和网站域名设置
添加CNAME文件配置自定义域名www.whu-cveo.com 更新astro.config.mjs添加站点URL配置 新增GitHub Actions工作流文件用于自动部署到GitHub Pages
1 parent 663cd3a commit 57bb05a

3 files changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
# 每次推送到 `main` 分支时触发这个“工作流程”
5+
# 如果你使用了别的分支名,请按需将 `main` 替换成你的分支名
6+
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
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout your repository using git
22+
uses: actions/checkout@v5
23+
- name: Install, build, and upload your site
24+
uses: withastro/action@v5
25+
# with:
26+
# path: . # 存储库中 Astro 项目的根位置。(可选)
27+
# node-version: 20 # 用于构建站点的特定 Node.js 版本,默认为 20。(可选)
28+
# package-manager: pnpm@latest # 应使用哪个 Node.js 包管理器来安装依赖项和构建站点。会根据存储库中的 lockfile 自动检测。(可选)
29+
# build-cmd: pnpm run build # 用于构建你的网站的命令。默认运行软件包的构建脚本或任务。(可选)
30+
# env:
31+
# PUBLIC_POKEAPI: 'https://pokeapi.co/api/v2' # 对变量值使用单引号。(可选)
32+
33+
deploy:
34+
needs: build
35+
runs-on: ubuntu-latest
36+
environment:
37+
name: github-pages
38+
url: ${{ steps.deployment.outputs.page_url }}
39+
steps:
40+
- name: Deploy to GitHub Pages
41+
id: deployment
42+
uses: actions/deploy-pages@v4

astro.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ import tailwind from '@astrojs/tailwind'
33

44
export default defineConfig({
55
integrations: [tailwind()],
6+
site: 'https://www.whu-cveo.com/',
67
})

public/CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
www.whu-cveo.com

0 commit comments

Comments
 (0)