From c45114b7dd68d606d2e9d80bbfe0f9baa63e5978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=93=AE?= <834207172@qq.com> Date: Fri, 28 Mar 2025 14:17:53 +0800 Subject: [PATCH] =?UTF-8?q?yml=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..c9a36c2 --- /dev/null +++ b/.gitlab-ci.yml @@ -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 "====== 发布完成 ========="