.drone.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. kind: pipeline
  2. name: default
  3. steps:
  4. - name: 生成 html,部署web
  5. image: cnlym/maven:3-jdk-11-alpine-aliyun
  6. volumes:
  7. - name: mvnCache
  8. path: /root/.m2
  9. - name: htmlDir
  10. path: /htmlDir
  11. commands:
  12. # 替换公共内容:目录、关键url、最新版本号
  13. - sh ./script/beforeGenHtml/replaceKey.sh
  14. #
  15. # 生成html
  16. - export _start_time_x=`date +%s`
  17. - mvn clean package -B -V
  18. - echo "【生成HTML cost="$((`date +%s` - $_start_time_x))"s"
  19. #
  20. # 处理html
  21. - export _start_time_x=`date +%s`
  22. - sh ./script/afterGenHtml/processShoulder.sh
  23. - chmod +x ./script/insertLink.sh
  24. - find target/generated-docs/ -type f -name "*.html" | xargs -n 1 ./script/insertLink.sh
  25. - sh ./script/afterGenHtml/processAll.sh
  26. - echo "【处理HTML cost="$((`date +%s` - $_start_time_x))"s"
  27. # 搬运到web目录(删除历史文档:避免索引错误)
  28. - rm -rf /htmlDir/*
  29. - cp -r target/generated-docs/* /htmlDir
  30. - cp ./script/insertLink.sh /htmlDir
  31. - chmod +x /htmlDir/insertLink.sh
  32. # docker run --rm -it -v $(pwd):/public theohbrothers/docker-pagefind:1.1.0
  33. - name: 生成 html search 页面
  34. image: theohbrothers/docker-pagefind:1.1.0
  35. volumes:
  36. - name: htmlDir
  37. path: /public
  38. - name: 钉钉通知
  39. image: guoxudongdocker/drone-dingtalk
  40. settings:
  41. token:
  42. from_secret: ding_token
  43. type: markdown
  44. message_color: true
  45. message_pic: true
  46. sha_link: true
  47. - name: 替换 pagefind,支持父页跳转
  48. image: cnlym/maven:3-jdk-11-alpine-aliyun
  49. volumes:
  50. - name: htmlDir
  51. path: /htmlDir
  52. commands:
  53. # 改为在 parent 打开
  54. - cp -f script/afterGenHtml/pagefind-ui.js /htmlDir/pagefind/pagefind-ui.js
  55. #- name: 生成 html,部署web 试验区
  56. # image: cnlym/maven:3-jdk-11-alpine-aliyun
  57. # volumes:
  58. # - name: mvnCache
  59. # path: /root/.m2
  60. # - name: htmlDirxxx
  61. # path: /htmlDirxxx
  62. # commands:
  63. # - sed -i 's#<!--<relative-basedir>true</relative-basedir>-->#<relative-basedir>true</relative-basedir>"#g' pom.xml
  64. # - mvn clean package -B -V
  65. # - cp -r target/generated-docs/* /htmlDirxxx
  66. volumes:
  67. - name: mvnCache
  68. host:
  69. path: /tmp/cache/.m2
  70. - name: htmlDir
  71. host:
  72. path: /opt/web/shoulderSpecsDoc
  73. - name: htmlDirxxx
  74. host:
  75. path: /opt/web/shoulderSpecsDocxxx
  76. trigger:
  77. branch:
  78. - master
  79. event:
  80. - push