Merge pull request #182 from 142vip/perf/update-deps #388
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
# | |
# 代码CI快速集成流水线,lint、fix、build | |
# 注意: 只在142vip/JavaScriptCollection时执行 | |
# | |
name: CI | |
# 触发条件 | |
on: | |
# 提PR到next分支触发CI | |
pull_request: | |
branches: | |
- next | |
push: | |
branches: | |
- next | |
# 手动触发部署 | |
workflow_dispatch: | |
# schedule: | |
# - cron: '0 0 1 * *' | |
# 环境变量 | |
env: | |
# 阿里云仓库信息 | |
REGISTRY: registry.cn-hangzhou.aliyuncs.com | |
UserName: 142vip | |
jobs: | |
Base-Build: | |
name: 基础编译构建 | |
runs-on: ubuntu-latest | |
if: github.repository == '142vip/JavaScriptCollection' && github.event_name == 'pull_request' | |
permissions: | |
actions: read | |
pull-requests: read | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录 | |
fetch-depth: 0 | |
# 安装PNPM | |
- name: PNPM Install | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9.6.0 | |
# 安装Node环境 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.16.0 | |
# 缓存 | |
cache: pnpm | |
# 下载依赖,并执行初始化脚本:钩子函数、思维导图构建 | |
- name: Install Dependencies | |
run: | | |
./scripts/ci | |
# - name: Code LintFix | |
# run: | | |
# pnpm lint | |
- name: Build Site | |
run: | | |
pnpm build | |
- name: Build Site With Proxy | |
run: | | |
pnpm build:proxy | |
# Build-Docker-Image: | |
# name: 构建Docker镜像 | |
# # macos不支持docker的使用 | |
# runs-on: ubuntu-latest | |
# # 主库master、next且执行release更新时执行 | |
# if: github.repository == '142vip/JavaScriptCollection' && startsWith(github.event.head_commit.message, 'chore(release):') | |
# permissions: | |
# actions: read | |
# pull-requests: read | |
# | |
# steps: | |
# - name: Checkout Code | |
# uses: actions/checkout@v4 | |
# with: | |
# fetch-depth: 0 | |
# | |
# - name: Set up QEMU | |
# uses: docker/setup-qemu-action@v3 | |
# | |
# - name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v3 | |
# | |
# - name: Login Docker | |
# run: | | |
# docker version | |
# echo "-----------Docker Login-----------" | |
# docker login \ | |
# --username=${{ env.UserName }} \ | |
# --password=${{ secrets.DOCKER_PASSWORD }} \ | |
# ${{env.REGISTRY}} | |
# | |
# - name: Install Dependencies | |
# run: | | |
# ./scripts/ci | |
# | |
# # 构建,支持domain | |
# - name: Build To Dist | |
# run: | | |
# pnpm build | |
# | |
# # 快速构建并推送 | |
# - name: Push Docker Image | |
# run: | | |
# ./scripts/bundle image_faster |