選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

.drone.yml 2.5KB

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