UNPKG

aqsc-mobile-com

Version:

基于uni-ui实现的二次封装

111 lines (110 loc) 3.74 kB
stages: - build - deploy variables: GIT_SUBMODULE_STRATEGY: normal # git clean 策略 #GIT_CLEAN_FLAGS: none GIT_CLEAN_FLAGS: -ffdx -e node_modules/ PROJECT: aqsc-mobile name: mobile-uni registry: ${HARBOR_URL}/aqsc before_script: - docker login ${HARBOR_URL} -u ${HARBOR_USR} -p ${HARBOR_PWD} #更新、编译、打包程序 build_job_test: variables: GIT_SUBMODULE_STRATEGY: normal before_script: - docker login ${HARBOR_URL} -u ${HARBOR_USR} -p ${HARBOR_PWD} - git submodule foreach git fetch - git checkout $CI_COMMIT_REF_NAME && git submodule foreach git checkout $CI_COMMIT_REF_NAME - git pull origin $CI_COMMIT_REF_NAME --allow-unrelated-histories && git submodule foreach git pull origin $CI_COMMIT_REF_NAME --allow-unrelated-histories #cache: #key: ${CI_BUILD_REF_NAME} #untracked: true #paths: #- node_modules/ stage: build only: - test script: - echo '编译程序阶段' - rm -rf dist/* - rm -rf dist*.zip - pnpm install - pnpm build:test - docker rmi `docker images | grep $name | awk '{print $1":"$2}'` || true # 清理工作环境 - rm -rf docker-build-vue/dist # 拷贝新打包的程序 - mv dist docker-build-vue/ # 切换工作目录 - cd docker-build-vue - echo "构建镜像并推送" - docker build -t $registry/$name:$CI_PIPELINE_ID . - docker push $registry/$name:$CI_PIPELINE_ID tags: - autobuild-157 # 2024年5月15日17:00:58 刘少晖 新增 更新、编译、打包程序 master build_job_master: variables: GIT_SUBMODULE_STRATEGY: normal before_script: - docker login ${HARBOR_URL} -u ${HARBOR_USR} -p ${HARBOR_PWD} - git submodule foreach git fetch - git checkout $CI_COMMIT_REF_NAME && git submodule foreach git checkout $CI_COMMIT_REF_NAME - git pull origin $CI_COMMIT_REF_NAME --allow-unrelated-histories && git submodule foreach git pull origin $CI_COMMIT_REF_NAME --allow-unrelated-histories #cache: #key: ${CI_BUILD_REF_NAME} #untracked: true #paths: #- node_modules/ stage: build only: - master script: - echo '编译程序阶段' - rm -rf dist/* - rm -rf dist*.zip - pnpm install - pnpm build:prod - docker rmi `docker images | grep $name | awk '{print $1":"$2}'` || true # 清理工作环境 - rm -rf docker-build-vue/dist # 拷贝新打包的程序 - mv dist docker-build-vue/ # 切换工作目录 - cd docker-build-vue - echo "构建镜像并推送" - docker build -t $registry/$name:$CI_PIPELINE_ID . - docker push $registry/$name:$CI_PIPELINE_ID tags: - autobuild-157 deploy_job_157: variables: GIT_STRATEGY: none stage: deploy only: - test script: - ssh root@192.168.0.16 "cd /data/aqsc-mobile; sed -r -i \"s/(image:)(.+)($name:)(.+)/\1\2\3${CI_PIPELINE_ID}\'/g\" docker-compose.yml ; docker-compose up -d; docker rmi `docker images | grep $name |grep -v $CI_PIPELINE_ID | awk '{print $1":"$2}'` || true;" #- echo '记录版本号' #- cd /data/docker-images/version-record #- sed -r -i "s/($name:)([0-9]+)/$name:${CI_PIPELINE_ID}/g" version-record tags: - autobuild-dev ### 2024年5月15日17:00:58 刘少晖 新增 记录master版本号 不进行部署 deploy_job_master: variables: GIT_STRATEGY: none stage: deploy only: - master script: - ssh root@192.168.0.16 "cd /data/aqsc-mobile;" - echo '记录版本号' - cd /data/docker-images/version-record - sed -r -i "s/($name:)([0-9]+)/$name:${CI_PIPELINE_ID}/g" version-record tags: - autobuild-dev