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

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