yml上传

This commit is contained in:
2025-03-28 14:17:53 +08:00
parent 7c0837df33
commit c45114b7dd

88
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,88 @@
image: node:14.17.1
before_script:
- echo '====== 准备构建中 ========='
stages:
- install
- lint
- build
- deploy
### 配置缓存
cache:
key:
files:
- package.json
- packages/ghost-weapp-ui/package.json
paths:
- node_modules/
- packages/ghost-weapp-ui/node_modules/
### 直接缓存.npm.npm中缓存了所有依赖因为gitlab缓存是分项目的所以两种方法个人觉得没有什么区别
# - .npm/
# eslint检测
job_lint:
only:
- master
stage: lint
before_script:
- echo 'eslint检测'
- ls -a
script:
- cd packages/ghost-weapp-ui
- ls -a
- yarn lint
- echo 'eslint检测完成'
retry: 0
when: 'on_success'
# 安装依赖
job_install:
only:
- master
stage: install
before_script:
- echo '安装依赖'
script:
- yarn config set registry https://registry.npm.taobao.org/
- yarn install
- cd packages/ghost-weapp-ui
- ls -a
- yarn install
- ls -a
- echo '依赖安装完成'
retry: 0
# 打包编译
job_build:
only:
- master
stage: build
before_script:
- echo '开始打包'
script:
- cd packages/ghost-weapp-ui
- ls -a
- yarn
- ls -a
- yarn build
- echo '构建完成'
when: 'on_success'
retry: 0
# 发布
job_deploy:
only:
- master
stage: deploy
before_script:
- echo '更新补丁版本,准备发布'
script:
- cd packages/ghost-weapp-ui
- node deploy.js ${CI_COMMIT_REF_NAME}
when: 'on_success'
retry: 0
after_script:
- echo "====== 发布完成 ========="