.drone.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. - name: ssh
  56. path: /root/.ssh
  57. commands:
  58. # 改为在 parent 打开
  59. - cp -f script/afterGenHtml/pagefind-ui.js /htmlDir/pagefind/pagefind-ui.js
  60. # 让 itlym.cn 网站同步更新
  61. - tar -zcf shoulder.tgz /htmlDir
  62. - scp shoulder.tgz root@itlym.cn:/opt/web/
  63. - ssh root@itlym.cn 'tar -zxf /opt/web/shoulder.tgz'
  64. #- name: 生成 html,部署web 试验区
  65. # image: cnlym/maven:3-jdk-11-alpine-aliyun
  66. # volumes:
  67. # - name: mvnCache
  68. # path: /root/.m2
  69. # - name: htmlDirxxx
  70. # path: /htmlDirxxx
  71. # commands:
  72. # - sed -i 's#<!--<relative-basedir>true</relative-basedir>-->#<relative-basedir>true</relative-basedir>"#g' pom.xml
  73. # - mvn clean package -B -V
  74. # - cp -r target/generated-docs/* /htmlDirxxx
  75. volumes:
  76. - name: mvnCache
  77. host:
  78. path: /tmp/cache/.m2
  79. - name: htmlDir
  80. host:
  81. path: /opt/web/shoulderSpecsDoc
  82. - name: htmlDirxxx
  83. host:
  84. path: /opt/web/shoulderSpecsDocxxx
  85. - name: ssh
  86. host:
  87. path: /root/.ssh
  88. trigger:
  89. branch:
  90. - master
  91. event:
  92. - push