wercker.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. release: # would be run on release branch
  58. steps:
  59. - script:
  60. name: bump version
  61. code: |
  62. sh ./bin/wercker/init-git.sh
  63. # npm version to bump version
  64. npm version patch
  65. # get version
  66. RELEASE_VERSION=`npm run version --silent`
  67. echo "RELEASE_VERSION=$RELEASE_VERSION"
  68. - script:
  69. name: commit and push
  70. code: |
  71. TMP_RELEASE_BRANCH=tmp/release-$RELEASE_VERSION
  72. git checkout -B $TMP_RELEASE_BRANCH
  73. git push -u origin HEAD:$TMP_RELEASE_BRANCH
  74. TARGET_COMMITISH=`git rev-parse HEAD`
  75. - github-create-release:
  76. token: $GITHUB_TOKEN
  77. tag: v$RELEASE_VERSION
  78. target-commitish: $TARGET_COMMITISH
  79. - script:
  80. name: remove temporary release branch
  81. code: |
  82. git push --delete origin $TMP_RELEASE_BRANCH
  83. trigger-crowi-plus-docker:
  84. steps:
  85. - script:
  86. name: trigger crowi-plus-docker release pipeline
  87. code: |- # strip linebreak
  88. curl -X POST
  89. -H "Content-Type: application/json"
  90. -H "Authorization: Bearer $WERCKER_TOKEN"
  91. https://app.wercker.com/api/v3/runs
  92. -d
  93. '{
  94. "pipelineId": "$TARGET_PIPELINE_ID",
  95. "sourceRunId": "$WERCKER_RUN_ID",
  96. "branch": "release",
  97. "envVars": [
  98. {
  99. "key": "RELEASE_VERSION",
  100. "value": "$RELEASE_VERSION"
  101. }
  102. ]
  103. }'