wercker.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. box: node:6.10
  2. services:
  3. - mongo:3.4
  4. test:
  5. steps:
  6. - script:
  7. name: set yarn cache-folder
  8. code: yarn config set cache-folder $WERCKER_CACHE_DIR/yarn
  9. - script:
  10. name: install dependencies
  11. code: |
  12. yarn global add npm@4
  13. yarn install
  14. - script:
  15. name: print dependencies
  16. code: yarn list --depth=0
  17. - script:
  18. name: npm test
  19. code: |
  20. export MONGO_URI=mongodb://$MONGO_PORT_27017_TCP_ADDR/crowi_test
  21. echo "export MONGO_URI=$MONGO_URI"
  22. npm test
  23. build-prod:
  24. steps:
  25. - script:
  26. name: set yarn cache-folder
  27. code: yarn config set cache-folder $WERCKER_CACHE_DIR/yarn
  28. - script:
  29. name: install dependencies
  30. code: |
  31. yarn global add npm@4
  32. yarn install --production
  33. - script:
  34. name: print dependencies
  35. code: yarn list --depth=0
  36. - script:
  37. name: npm run build:prod
  38. code: |
  39. npm run build:prod
  40. build-dev:
  41. steps:
  42. - script:
  43. name: set yarn cache-folder
  44. code: yarn config set cache-folder $WERCKER_CACHE_DIR/yarn
  45. - script:
  46. name: install dependencies
  47. code: |
  48. yarn global add npm@4
  49. yarn install
  50. - script:
  51. name: print dependencies
  52. code: yarn list --depth=0
  53. - script:
  54. name: npm run build:dev
  55. code: |
  56. npm run build:dev
  57. prepare-to-release: # would be run on release branch
  58. steps:
  59. - script:
  60. name: bump version
  61. code: |
  62. git config --global user.name "wercker"
  63. git config --global user.email "info@weseek.co.jp"
  64. # npm version to bump version
  65. npm version patch
  66. # export $RELEASE_VERSION
  67. export RELEASE_VERSION=`npm run version --silent`
  68. echo "export RELEASE_VERSION=$RELEASE_VERSION"
  69. - script:
  70. name: push to github to create new branch
  71. code: |
  72. # reconfigure origin
  73. GITHUB_ORIGIN=https://yuki-takei:$GITHUB_TOKEN@$WERCKER_GIT_DOMAIN/$WERCKER_GIT_OWNER/$WERCKER_GIT_REPOSITORY.git
  74. git remote set-url origin $GITHUB_ORIGIN
  75. git checkout -B tmp/release-$RELEASE_VERSION
  76. git push -u origin HEAD:tmp/release-$RELEASE_VERSION
  77. release-to-github: # would be run on temporary release branch
  78. steps:
  79. - script:
  80. name: get version
  81. code: |
  82. export RELEASE_VERSION=`npm run version --silent`
  83. echo "export RELEASE_VERSION=$RELEASE_VERSION"
  84. - github-create-release:
  85. token: $GITHUB_TOKEN
  86. tag: v$RELEASE_VERSION
  87. - script:
  88. name: remove temporary release branch
  89. code: |
  90. git config --global user.name "wercker"
  91. git config --global user.email "info@weseek.co.jp"
  92. # reconfigure origin
  93. GITHUB_ORIGIN=https://yuki-takei:$GITHUB_TOKEN@$WERCKER_GIT_DOMAIN/$WERCKER_GIT_OWNER/$WERCKER_GIT_REPOSITORY.git
  94. git remote rm origin
  95. git remote add origin $GITHUB_ORIGIN
  96. # remove branch
  97. git push --delete origin $WERCKER_GIT_BRANCH
  98. # the pipeline that do nothing
  99. # this is needed while wercker can't detect specified branch pushed
  100. empty:
  101. steps:
  102. - script:
  103. code: echo "this is $WERCKER_GIT_BRANCH branch"