kind: pipeline name: default steps: - name: 生成 html,部署web image: cnlym/maven:3-jdk-11-alpine-aliyun volumes: - name: mvnCache path: /root/.m2 - name: htmlDir path: /htmlDir commands: # 替换公共内容:目录、关键url、最新版本号 - sh ./script/beforeGenHtml/replaceKey.sh - locale - export LANG=en_US.UTF-8 - export LC_ALL=en_US.UTF-8 # # 生成html - export _start_time_x=`date +%s` - mvn clean package -B -V - echo "【生成HTML cost="$((`date +%s` - $_start_time_x))"s" # # 处理html - export _start_time_x=`date +%s` - sh ./script/afterGenHtml/processShoulder.sh - chmod +x ./script/insertLink.sh - find target/generated-docs/ -type f -name "*.html" | xargs -n 1 ./script/insertLink.sh - sh ./script/afterGenHtml/processAll.sh - echo "【处理HTML cost="$((`date +%s` - $_start_time_x))"s" # 搬运到web目录(删除历史文档:避免索引错误) - rm -rf /htmlDir/* - cp -r target/generated-docs/* /htmlDir - cp ./script/insertLink.sh /htmlDir - chmod +x /htmlDir/insertLink.sh # docker run --rm -it -v $(pwd):/public theohbrothers/docker-pagefind:1.1.0 - name: 生成 html search 页面 image: theohbrothers/docker-pagefind:1.1.0 volumes: - name: htmlDir path: /public - name: 钉钉通知 image: guoxudongdocker/drone-dingtalk settings: token: from_secret: ding_token type: markdown message_color: true message_pic: true sha_link: true - name: 替换 pagefind,支持父页跳转 image: cnlym/maven:3-jdk-11-alpine-aliyun volumes: - name: htmlDir path: /htmlDir - name: ssh path: /root/.ssh commands: # 改为在 parent 打开 - cp -f script/afterGenHtml/pagefind-ui.js /htmlDir/pagefind/pagefind-ui.js # 让 itlym.cn 网站同步更新 - tar -zcf shoulder.tgz /htmlDir - scp shoulder.tgz root@itlym.cn:/opt/web/ - ssh root@itlym.cn 'tar -zxf /opt/web/shoulder.tgz' #- name: 生成 html,部署web 试验区 # image: cnlym/maven:3-jdk-11-alpine-aliyun # volumes: # - name: mvnCache # path: /root/.m2 # - name: htmlDirxxx # path: /htmlDirxxx # commands: # - sed -i 's##true"#g' pom.xml # - mvn clean package -B -V # - cp -r target/generated-docs/* /htmlDirxxx volumes: - name: mvnCache host: path: /tmp/cache/.m2 - name: htmlDir host: path: /opt/web/shoulderSpecsDoc - name: htmlDirxxx host: path: /opt/web/shoulderSpecsDocxxx - name: ssh host: path: /root/.ssh trigger: branch: - master event: - push