.travis.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. language: node_js
  2. sudo: required
  3. dist: xenial
  4. addons:
  5. chrome: stable
  6. node_js:
  7. - 8
  8. env:
  9. global:
  10. - CHROMEDRIVER_VERSION=LATEST
  11. - NODE_ENV=production
  12. - NODE_OPTIONS=--max-old-space-size=7250
  13. - NPM_TAG=latest
  14. - RELEASE_VERSION="0.1.0-prerelease.$(date +'%Y%m%d%H%M%S')"
  15. cache:
  16. directories:
  17. - node_modules
  18. install:
  19. - npm --production=false install
  20. script:
  21. - npm test
  22. before_deploy:
  23. - >
  24. if [ -z "$BEFORE_DEPLOY_RAN" ]; then
  25. npm --no-git-tag-version version $RELEASE_VERSION
  26. if [ "$TRAVIS_BRANCH" == "master" ]; then export NPM_TAG=stable; fi
  27. if [[ "$TRAVIS_BRANCH" == hotfix/* ]]; then export NPM_TAG=hotfix; fi # double brackets are important for matching the wildcard
  28. git config --global user.email $(git log --pretty=format:"%ae" -n1)
  29. git config --global user.name $(git log --pretty=format:"%an" -n1)
  30. export BEFORE_DEPLOY_RAN=true
  31. fi
  32. deploy:
  33. - provider: npm
  34. on:
  35. branch:
  36. - master
  37. - develop
  38. - hotfix/*
  39. condition: $TRAVIS_EVENT_TYPE != cron
  40. skip_cleanup: true
  41. email: $NPM_EMAIL
  42. api_key: $NPM_TOKEN
  43. tag: $NPM_TAG
  44. - provider: script
  45. on:
  46. branch:
  47. - master
  48. - develop
  49. - smoke
  50. - hotfix/*
  51. condition: $TRAVIS_EVENT_TYPE != cron
  52. skip_cleanup: true
  53. script: if npm info scratch-gui | grep -q $RELEASE_VERSION; then git tag $RELEASE_VERSION && git push https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git $RELEASE_VERSION; fi
  54. - provider: script
  55. on:
  56. all_branches: true
  57. condition: $TRAVIS_EVENT_TYPE != cron && ! $TRAVIS_BRANCH =~ ^greenkeeper/
  58. tags: false # Don't push tags to gh-pages
  59. skip_cleanup: true
  60. script: npm run deploy -- -x -e $TRAVIS_BRANCH -r https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git
  61. - provider: script
  62. on:
  63. branch: develop
  64. condition: $TRAVIS_EVENT_TYPE == cron
  65. skip_cleanup: true
  66. script: npm run i18n:src && npm run i18n:push