dist-update.sh 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_TEST_RESULT" == "0" ]]; then
  2. echo -e "Starting to update of dist folder\n"
  3. #configure git to commit as Travis
  4. git config --global user.email "travis@travis-ci.org"
  5. git config --global user.name "Travis"
  6. cd $HOME
  7. #clone skulpt
  8. git clone --quiet https://${GH_TOKEN}@github.com/skulpt/skulpt.git skulpt # > /dev/null
  9. #clone dist
  10. git clone --quiet https://${GH_TOKEN}@github.com/skulpt/skulpt-dist.git dist # > /dev/null
  11. #compare tags
  12. cd $HOME
  13. cd skulpt
  14. git tag > ../tags-skulpt
  15. cd ../dist
  16. git tag > ../tags-dist
  17. cd ..
  18. #compare two files per line.
  19. #-F, --fixed-strings
  20. # Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched.
  21. #-x, --line-regexp
  22. # Select only those matches that exactly match the whole line.
  23. #-v, --invert-match
  24. # Invert the sense of matching, to select non-matching lines.
  25. #-f FILE, --file=FILE
  26. # Obtain patterns from FILE, one per line. The empty file contains zero patterns, and therefore matches nothing.
  27. grep -Fxvf tags-dist tags-skulpt > new-tags
  28. for TAG in $(cut -d, -f2 < new-tags)
  29. do
  30. echo "Found new tag: $TAG"
  31. #we have a new tag
  32. export NEWTAG=true
  33. #build skulpt at this tag
  34. cd $HOME/skulpt
  35. git checkout tags/$TAG
  36. npm install jscs
  37. npm install git://github.com/jshint/jshint/
  38. ./skulpt.py dist -u
  39. #create zip and tarbals
  40. cd dist
  41. tar -czf skulpt-latest.tar.gz *.js
  42. zip skulpt-latest.zip *.js
  43. mkdir -p ../doc/static/dist
  44. mv *.zip ../doc/static/dist/
  45. mv *.tar.gz ../doc/static/dist/
  46. #update skulpt for the site.
  47. cp skulpt.min.js ../doc/static/
  48. cp skulpt-stdlib.js ../doc/static/
  49. cp *.js ../../dist/
  50. cd ..
  51. cp bower.json ../dist
  52. cp .bowerrc ../dist
  53. #put the new version in the dist repository
  54. cd ../dist
  55. git add .
  56. git commit -m "Skulpt version: $TAG"
  57. git tag $TAG
  58. git push -fq --tags origin master > /dev/null
  59. done
  60. #reset dist repository to HEAD just to be sure
  61. cd $HOME
  62. cd dist
  63. git reset HEAD --hard
  64. cd $HOME
  65. #build skulpt
  66. cd skulpt
  67. git reset HEAD --hard
  68. ./skulpt.py dist -u
  69. cd dist
  70. cp *.js ../../dist/
  71. cd ..
  72. cp bower.json ../dist
  73. cp .bowerrc ../dist
  74. #add, commit and push files to the dist repository
  75. cd ../dist
  76. git add .
  77. git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed"
  78. git push -fq origin master > /dev/null
  79. if [[ "$NEWTAG" == "true" ]]; then
  80. echo "Download GAE"
  81. wget http://googleappengine.googlecode.com/files/google_appengine_1.8.3.zip -nv
  82. unzip -qd ~/vendors google_appengine_1.8.3.zip
  83. #stop if google appengine isn't installed.
  84. if [ ! -f ~/vendors/google_appengine/appcfg.py ]; then
  85. echo "can't find appcfg.py"
  86. exit 1
  87. fi
  88. echo "Updating site"
  89. cd $HOME/skulpt/doc
  90. ~/vendors/google_appengine/appcfg.py --oauth2_refresh_token=${GAE_REFRESH} update ./
  91. echo "Successfully updated skulpt.org"
  92. fi
  93. echo -e "Done magic with coverage\n"
  94. else
  95. echo -e "Not updating dist folder because TRAVIS_PULL_REQUEST = $TRAVIS_PULL_REQUEST and TRAVIS_TEST_RESULT = $TRAVIS_TEST_RESULT"
  96. fi