-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f0136d
commit 6e7c842
Showing
4 changed files
with
177 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,61 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
# 构建 VitePress 站点并将其部署到 GitHub Pages 的示例工作流程 | ||
|
||
name: deploy-docs-website | ||
name: Deploy VitePress site to Pages | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the "main" branch | ||
# 在针对 `main` 分支的推送上运行 | ||
push: | ||
branches: ["main"] | ||
# pull_request: | ||
# branches: [ "main" ] | ||
branches: [main] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
# 允许你从 Actions 选项卡手动运行此工作流程 | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列 | ||
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成 | ||
concurrency: | ||
group: pages | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# This workflow contains a single job called "build" | ||
# 构建工作 | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
- name: install nodejs | ||
uses: actions/[email protected] | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
node-version: "16.X" | ||
- name: install deps | ||
run: npm install | ||
- name: build app | ||
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: npm | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Build with VitePress | ||
run: npm run docs:build | ||
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
publish_dir: docs/.vitepress/dist | ||
github_token: ${{ secrets.ACTION_TOKEN }} | ||
commit_message: 自动部署 # 5.部署时的 git 提交信息,自由填写 | ||
path: docs/.vitepress/dist | ||
|
||
# 部署工作 | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
needs: build | ||
runs-on: ubuntu-latest | ||
name: Deploy | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: deploy-docs-website | ||
|
||
# Controls when the workflow will run | ||
#on: | ||
# Triggers the workflow on push or pull request events but only for the "main" branch | ||
#push: | ||
# branches: ["main"] | ||
# pull_request: | ||
# branches: [ "main" ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
- name: install nodejs | ||
uses: actions/[email protected] | ||
with: | ||
node-version: "16.X" | ||
- name: install deps | ||
run: npm install | ||
- name: build app | ||
run: npm run docs:build | ||
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
publish_dir: docs/.vitepress/dist | ||
github_token: ${{ secrets.ACTION_TOKEN }} | ||
commit_message: 自动部署 # 5.部署时的 git 提交信息,自由填写 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ name: docs-pr | |
on: | ||
# Triggers the workflow on push or pull request events but only for the "main" branch | ||
pull_request: | ||
branches: [ "main" ] | ||
branches: ["main"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
@@ -22,11 +22,25 @@ jobs: | |
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
- name: install nodejs | ||
- name: Install nodejs | ||
uses: actions/[email protected] | ||
with: | ||
with: | ||
node-version: "16.X" | ||
- name: install deps | ||
- name: Install deps | ||
run: npm install | ||
- name: build app | ||
- name: Build docs | ||
run: npm run docs:build | ||
- name: Check Build Status | ||
id: build_status | ||
run: echo "::set-output name=status::success" | ||
|
||
merge: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Merge PR | ||
if: ${{ needs.build.outputs.status == 'success' }} | ||
uses: pullreminders/merge-me-action@v2 | ||
with: | ||
github_token: ${{ secrets.ACTION_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters