-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/Gyj918/GW_Admin
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Deploy VitePress site to Pages | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
|
||
# 设置tokenn访问权限 | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列 | ||
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成 | ||
concurrency: | ||
group: pages | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# 构建工作 | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要 | ||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v2 # 安装pnpm并添加到环境变量 | ||
with: | ||
version: 8.6.12 # 指定需要的 pnpm 版本 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: pnpm # 设置缓存 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 # 在工作流程自动配置GithubPages | ||
- name: Install dependencies | ||
run: pnpm install # 安装依赖 | ||
- name: Build with VitePress | ||
run: | | ||
pnpm run docs:build # 启动项目 | ||
touch .nojekyll # 通知githubpages不要使用Jekyll处理这个站点,不知道为啥不生效,就手动搞了 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v2 # 上传构建产物 | ||
with: | ||
path: .vitepress/dist # 指定上传的路径,当前是根目录,如果是docs需要加docs/的前缀 | ||
|
||
# 部署工作 | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} # 从后续的输出中获取部署后的页面URL | ||
needs: build # 在build后面完成 | ||
runs-on: ubuntu-latest # 运行在最新版本的ubuntu系统上 | ||
name: Deploy | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment # 指定id | ||
uses: actions/deploy-pages@v2 # 将之前的构建产物部署到github pages中 |