.drone.yml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. kind: pipeline
  2. name: default
  3. steps:
  4. - name: 生成 html,部署web,国内 cdn 加速访问
  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. # 生成html
  13. - export _start_time_x=`date +%s`
  14. - mvn clean generate-resources -B -V
  15. - echo "【生成HTML cost="$((`date +%s` - $_start_time_x))"s"
  16. # 加备案号
  17. - export _start_time_x=`date +%s`
  18. - find target/shoulder-specs/ -type f -name "index.html" | xargs sed -i 's#<div id="footer-text">#<div id="footer-text"><a href="https://beian.miit.gov.cn/" target="_blank">鲁ICP备20024731号-1</a></br>#g'
  19. - echo "【加备案号 cost="$((`date +%s` - $_start_time_x))"s"
  20. # 国内访问加速: 替换 css、js 为国内七牛云 cdn 地址
  21. - export _start_time_x=`date +%s`
  22. - find target/shoulder-specs/ -type f -name "*.html" | xargs sed -i 's#cdnjs.cloudflare.com/ajax/libs#cdn.staticfile.org#g'
  23. - echo "【替换css cost="$((`date +%s` - $_start_time_x))"s"
  24. # 国内访问加速: 替换 google 字体地址为 其他的
  25. - export _start_time_x=`date +%s`
  26. - find target/shoulder-specs/ -type f -name "*.html" | xargs sed -i 's#fonts.googleapis.com#fonts.cat.net#g'
  27. - echo "【替换字体 cost="$((`date +%s` - $_start_time_x))"s"
  28. #- sed -i "s!cdnjs.cloudflare.com/ajax/libs!cdn.staticfile.org!g" `grep cdnjs.cloudflare -rl target/shoulder-specs/`
  29. # 搬运到web目录(目前不会删除历史文档,只有更新)
  30. - export _start_time_x=`date +%s`
  31. - cp -r target/shoulder-specs/* /htmlDir
  32. - echo "【搬运HTML cost="$((`date +%s` - $_start_time_x))"s"
  33. - name: 钉钉通知
  34. image: guoxudongdocker/drone-dingtalk
  35. settings:
  36. token: 5f6c32b36e771df227b1ccb8898325158e12d851ae61982d1ec225a1aa58e251
  37. type: markdown
  38. volumes:
  39. - name: mvnCache
  40. host:
  41. path: /tmp/cache/.m2
  42. - name: htmlDir
  43. host:
  44. path: /opt/web/shoulderSpecsDoc
  45. trigger:
  46. branch:
  47. - master
  48. event:
  49. - push