Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

.drone.yml 2.6KB

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