You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

.drone.yml 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. kind: pipeline
  2. name: default
  3. steps:
  4. - name: versioning
  5. image: node:12
  6. commands:
  7. - echo "${PACKAGE_VERSION}"
  8. - echo "${LATEST_VERSION}"
  9. - echo ${DRONE_BUILD_CREATED}
  10. - git config --global user.email "frontwork.me@gmail.com";
  11. - git config --global user.name "drone";
  12. - if [ "${PACKAGE_VERSION}" != "${LATEST_VERSION}" ];
  13. then
  14. git tag $PACKAGE_VERSION
  15. git status
  16. git push https://$GIT_USER:$GIT_PASSWORD@gitea.frontblock.me/fw-vendor/${DRONE_REPO_NAME}.git $PACKAGE_VERSION;
  17. else
  18. echo 'Version '
  19. echo $LATEST_VERSION
  20. echo 'did not change. Don`t push tag to master';
  21. fi
  22. environment:
  23. LATEST_VERSION:
  24. $(npm view rpclibrary | grep latest | head -1 | awk -F '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')
  25. PACKAGE_VERSION:
  26. $(cat package.json | grep version | head -1 | awk -F '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')
  27. GIT_USER:
  28. from_secret: git_user
  29. GIT_PASSWORD:
  30. from_secret: git_password
  31. trigger:
  32. event:
  33. exclude:
  34. - tag
  35. - name: restore cache
  36. image: drillster/drone-volume-cache
  37. settings:
  38. restore: true
  39. mount:
  40. - ./node_modules
  41. volumes:
  42. - name: cache
  43. path: /cache
  44. - name: npm install
  45. image: node:12
  46. commands:
  47. - npm install
  48. - name: npm run build
  49. image: node:12
  50. commands:
  51. - npm run build
  52. - name: rebuild cache
  53. image: drillster/drone-volume-cache
  54. settings:
  55. rebuild: true
  56. mount:
  57. - ./node_modules
  58. volumes:
  59. - name: cache
  60. path: /cache
  61. - name: npm run test
  62. image: node:12
  63. commands:
  64. - npm run test
  65. - name: rebuild documentation
  66. image: node:12
  67. commands:
  68. - rm -rf docs
  69. - npm run docs
  70. trigger:
  71. event:
  72. - tag
  73. - name: npm publish
  74. image: plugins/npm
  75. settings:
  76. username: frontwork
  77. password:
  78. from_secret: npm_password
  79. email: frontwork.me@gmail.com
  80. trigger:
  81. event:
  82. - tag
  83. - name: commit documentation
  84. image: node:12
  85. commands:
  86. - git config --global user.email "frontwork.me@gmail.com"
  87. - git config --global user.name "drone"
  88. - git add -f docs
  89. - git commit --allow-empty -m "documented version at ${DRONE_BUILD_CREATED}"
  90. - git tag ${DRONE_BUILD_CREATED}
  91. - git status
  92. - git push https://$GIT_USER:$GIT_PASSWORD@gitea.frontblock.me/fw-vendor/${DRONE_REPO_NAME}.git master ${DRONE_BUILD_CREATED}
  93. environment:
  94. GIT_USER:
  95. from_secret: git_user
  96. GIT_PASSWORD:
  97. from_secret: git_password
  98. trigger:
  99. event:
  100. - tag
  101. volumes:
  102. - name: cache
  103. host:
  104. path: /tmp