Skip to content

Commit

Permalink
添加文件
Browse files Browse the repository at this point in the history
  • Loading branch information
easygl1der committed May 2, 2024
2 parents ef891dd + 2be3def commit 2ee7491
Showing 1 changed file with 36 additions and 20 deletions.
56 changes: 36 additions & 20 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,77 @@
# Sample workflow for building and deploying a VitePress site to GitHub Pages
#
name: Deploy VitePress site to Pages

on:
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
# using the `master` branch as the default branch.
push:
branches: [master]
branches: [main]

# 设置tokenn访问权限
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false

jobs:
# 构建工作
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
<<<<<<< HEAD
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要
- name: Setup pnpm
uses: pnpm/action-setup@v2 # 安装pnpm并添加到环境变量
with:
version: 9.0.6 # 指定需要的 pnpm 版本
=======
fetch-depth: 0 # Not needed if lastUpdated is not enabled
# - uses: pnpm/action-setup@v3 # Uncomment this if you're using pnpm
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
>>>>>>> 2be3def6bb93bd703b9293913908deb9b323cedf
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
<<<<<<< HEAD
node-version: 20.12.2
cache: pnpm # 设置缓存
=======
node-version: 20
cache: npm # or pnpm / yarn
>>>>>>> 2be3def6bb93bd703b9293913908deb9b323cedf
- name: Setup Pages
uses: actions/configure-pages@v3 # 在工作流程自动配置GithubPages
uses: actions/configure-pages@v4
- name: Install dependencies
run: pnpm install # 安装依赖
run: npm ci # or pnpm install / yarn install / bun install
- name: Build with VitePress
run: |
pnpm run docs:build # 启动项目
touch .nojekyll # 通知githubpages不要使用Jekyll处理这个站点,不知道为啥不生效,就手动搞了
run: npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v2 # 上传构建产物
uses: actions/upload-pages-artifact@v3
with:
path: .vitepress/dist # 指定上传的路径,当前是根目录,如果是docs需要加docs/的前缀
path: .vitepress/dist

# 部署工作
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }} # 从后续的输出中获取部署后的页面URL
needs: build # 在build后面完成
runs-on: ubuntu-latest # 运行在最新版本的ubuntu系统上
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment # 指定id
uses: actions/deploy-pages@v2 # 将之前的构建产物部署到github pages中
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 2ee7491

Please sign in to comment.