Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 33 additions & 16 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,75 @@
name: Deploy to GitHub Pages
# 部署文档站点到 GitHub Pages
name: Deploy Docs to Pages

# 触发条件
on:
# 推送到 main 分支且 docs 目录有变更时触发
push:
branches:
- main
branches: [main]
paths:
- "docs/**"

# PR 到 main 分支且 docs 目录有变更时触发(仅构建,不部署)
pull_request:
branches:
- main
branches: [main]
paths:
- "docs/**"

# 允许手动触发
workflow_dispatch:

# 设置 GitHub Pages 部署所需的权限
permissions:
contents: read
pages: write
id-token: write

# 只允许一个并发部署
concurrency:
group: "pages"
group: pages
cancel-in-progress: false

jobs:
# 构建任务
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'docs/package-lock.json'
node-version: "20"
cache: "npm"
cache-dependency-path: "docs/package-lock.json"

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Install dependencies
run: |
cd docs
npm ci
run: npm ci
working-directory: docs

- name: Build
run: |
cd docs
npm run generate
run: npm run generate
working-directory: docs

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.output/public

# 部署任务
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@ on:
branches:
- main
- develop
paths-ignore:
- "docs/**"
- "**.md"
- ".github/workflows/deploy-docs.yml"
pull_request:
branches:
- main
- develop
paths-ignore:
- "docs/**"
- "**.md"
- ".github/workflows/deploy-docs.yml"
workflow_dispatch:

permissions:
Expand Down Expand Up @@ -44,6 +52,7 @@ jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
go-version: ['1.22', '1.23']
Expand Down
Loading