1
0
mirror of https://github.com/142vip/408CSFamily.git synced 2026-04-13 18:00:58 +08:00

perf: 修改CI代码拉取策略,简化scripts脚本命令 (#54)

* perf: 修改CI代码拉取策略,简化scripts脚本命令

* feat: markmap-cli开发环境依赖

---------

Co-authored-by: chu fan <fairy_408@2925.com>
This commit is contained in:
mmdapl
2023-10-10 11:10:22 +08:00
committed by GitHub
parent 75acf78f45
commit 5e1aedbd46
5 changed files with 1270 additions and 34 deletions

View File

@@ -25,22 +25,28 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18.18.0
- name: PNPM Install
uses: pnpm/action-setup@v2
with:
version: 7
run_install: true
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18.18.0
## 淘宝镜像加速
registry-url: 'https://registry.npmmirror.com'
cache: 'pnpm'
- name: Install Dependencies
run: |
pnpm i --frozen-lockfile --registry https://registry.npmmirror.com
- name: Cache Dependencies
uses: actions/cache@v3
@@ -52,13 +58,16 @@ jobs:
## 部署到Github-Pages
deploy-github:
name: "部署到Github-Pages"
needs: install-init
needs:
- install-init
runs-on: macos-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0
- name: Restore Dependencies From cache
@@ -69,6 +78,11 @@ jobs:
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
## 支持思维导图转化
- name: Build Mark-Map
run: |
./scripts/mark-map
# 运行构建脚本
- name: Build VuePress Site
run: ls -a && ./scripts/bundle build_proxy
@@ -84,13 +98,16 @@ jobs:
## 部署到vercel平台
deploy-vercel:
name: "部署到Vercel平台"
needs: install-init
needs:
- install-init
runs-on: ubuntu-latest
if: github.repository == '142vip/408CSFamily'
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0
- name: Restore Dependencies From Cache
@@ -100,6 +117,11 @@ jobs:
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
## 支持思维导图转化
- name: Build Mark-Map
run: |
./scripts/mark-map
- name: Pull Vercel Environment Information
run: vercel -v && vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
@@ -114,17 +136,24 @@ jobs:
release:
name: "创建Github发布"
runs-on: macos-latest
needs: install-init
needs:
- install-init
## 主库master、next且执行release更新时执行
if: github.repository == '142vip/408CSFamily' && startsWith(github.event.head_commit.message, 'chore(release):')
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0
## 支持思维导图转化
- name: Build Mark-Map
run: |
./scripts/mark-map
### 打成压缩包
- name: Create Zip Package
run: |

View File

@@ -1,14 +1,12 @@
## 代码CI快速集成流水线lint、fix、build
name: CI
## 触发条件
on:
# 提PR到next分支触发CI
pull_request:
branches:
- 'master'
- 'next'
- '!pages/**'
- next
push:
branches:
- master
@@ -28,9 +26,10 @@ jobs:
pull-requests: read
steps:
- name: checkout code
uses: actions/checkout@v3
- name: Checkout Code
uses: actions/checkout@v4
with:
persist-credentials: false
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0
@@ -43,24 +42,31 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18.18.0
## 淘宝镜像加速
registry-url: 'https://registry.npmmirror.com'
cache: 'pnpm'
- name: Install Dependencies
run: pnpm i --frozen-lockfile --registry https://registry.npmmirror.com
run: |
pnpm i --frozen-lockfile --registry https://registry.npmmirror.com
- name: Cache Dependencies
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
Base-Build:
name: "基础编译构建"
runs-on: macos-latest
needs: install-init
needs:
- install-init
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0
- name: Restore Dependencies From Cache
@@ -70,18 +76,27 @@ jobs:
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Code LintFix
run: ./scripts/lint --fix
run: |
./scripts/lint --fix
## 支持思维导图转化
- name: Build Mark-Map
run: |
./scripts/mark-map
- name: Build Site
run: ./scripts/bundle build
run: |
./scripts/bundle build
- name: Build Site With Proxy
run: ./scripts/bundle build_proxy
run: |
./scripts/bundle build_proxy
Build-Docker-Image:
name: "构建Docker镜像"
runs-on: macos-latest
needs: install-init
needs:
- install-init
## 主库且tag更新时执行
if: github.repository == '142vip/408CSFamily' && startsWith(github.ref, 'refs/tags/v')
permissions:
@@ -90,8 +105,9 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0
@@ -110,10 +126,17 @@ jobs:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
## 支持思维导图转化
- name: Build Mark-Map
run: |
./scripts/mark-map
## 构建支持domain
- name: Build To Dist
run: ./scripts/bundle build_proxy
run: |
./scripts/bundle build_proxy
## 快速构建并推送
- name: Push Docker Image
run: ./scripts/bundle image_faster
run: |
./scripts/bundle image_faster