.drone.yml 2.4 KB

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