package.sh 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. #Steps when making a new release:
  2. #0. Update CHANGES.MD
  3. #1. Update version number:
  4. # i. In AToMPM - client/constants.js
  5. # ii. In documentation - doc/config.py
  6. # iii. In Node - package.json
  7. #2. Create a new release on GitHub
  8. #3. The tag should be something like v0.8.0
  9. #4. Run this script, which will download the latest tagged version
  10. # and package everything
  11. #5. Upload the package .zip to the release on GitHub
  12. #6. Publish to npm repo
  13. nodejs_zip_url="https://nodejs.org/dist/v8.11.3/node-v8.11.3-win-x64.zip"
  14. portable_python_url="http://elvis.rowan.edu/mirrors/portablepython/v2.7/PortablePython_2.7.6.1.exe"
  15. igraph_whl_url="https://github.com/AToMPM/atompm/releases/download/v0.7.0/python_igraph-0.7.1.post6-cp27-cp27m-win32.whl"
  16. chrome_url="https://newcontinuum.dl.sourceforge.net/project/portableapps/Google%20Chrome%20Portable/GoogleChromePortable_67.0.3396.87_online.paf.exe"
  17. manual_url="https://media.readthedocs.org/pdf/atompm/latest/atompm.pdf"
  18. version=$(curl --silent "https://api.github.com/repos/AToMPM/atompm/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")')
  19. echo "Packaging version: $version"
  20. #echo $nodejs_zip_url
  21. #echo $portable_python_url
  22. #echo $igraph_whl_url
  23. # STEPS
  24. # 1. Download Python
  25. # a. Currently, this is PortablePython from
  26. # b. http://portablepython.com/wiki/PortablePython2.7.6.1/
  27. function get_PP() {
  28. echo "Downloading PortablePython"
  29. PP_file=$(basename $portable_python_url)
  30. echo $PP_file
  31. if [ ! -f $PP_file ]; then
  32. echo "Downloading $portable_python_url"
  33. curl -O $portable_python_url
  34. fi
  35. # c. Install PortablePython with no packages selected
  36. #TODO: Automate installation
  37. #Z:\home\dcx\Projects\AToMPM\packaging\atompm-portable\platform\PortablePython27\
  38. #No modules and no core editors
  39. wine $PP_file
  40. # d. Install pip on the packaging machine (Python2 version)
  41. cd atompm-portable/platform/PortablePython27/App
  42. # INSTALL PIP
  43. #TODO: Fix this installation
  44. #wine scripts/easy_install.exe pip
  45. #TODO: Replace with above
  46. #pip2 install --upgrade --target=Lib/site-packages/ pip
  47. #INSTALL IGRAPH
  48. igraph_whl_file=$(basename $igraph_whl_url)
  49. echo $igraph_whl_file
  50. #if [ ! -f $igraph_whl_file ]; then
  51. # echo "Downloading $igraph_whl_url"
  52. # curl -O $igraph_whl_url
  53. #fi
  54. #MUST HAVE WHL FILE LOCALLY FOR NOW
  55. cd ../../../..
  56. unzip -o $igraph_whl_file -d atompm-portable/platform/PortablePython27/App/Lib/site-packages/
  57. }
  58. function get_nodejs() {
  59. echo "Downloading NodeJS"
  60. # 2. Download node.js https://nodejs.org/en/download/
  61. # a. Choose Windows Binary (.zip)
  62. nodejs_file=$(basename $nodejs_zip_url)
  63. echo $nodejs_file
  64. if [ ! -f $nodejs_file ]; then
  65. echo "Downloading $nodejs_zip_url"
  66. curl -O $nodejs_zip_url
  67. fi
  68. unzip -o $nodejs_file -d atompm-portable/platform/
  69. mv atompm-portable/platform/node-v* atompm-portable/platform/NodeJS
  70. }
  71. # 3. Add ChromePortable
  72. function get_chrome() {
  73. echo "Downloading PortableChrome"
  74. chrome_file=$(basename $chrome_url)
  75. echo $chrome_file
  76. if [ ! -f $chrome_file ]; then
  77. echo "Downloading $chrome_url"
  78. curl -O $chrome_url
  79. fi
  80. #TODO: Automate installation
  81. #Z:\home\dcx\Projects\AToMPM\packaging\atompm-portable\platform\GoogleChromePortable
  82. wine GoogleChromePortable_67.0.3396.87_online.paf.exe
  83. }
  84. # 4. Add AToMPM files
  85. function add_atompm () {
  86. echo "Adding AToMPM"
  87. rm -rf atompm-portable/atompm
  88. cd atompm-portable
  89. git clone --depth 1 https://github.com/AToMPM/atompm.git
  90. cd atompm
  91. git checkout $version
  92. rm -rf .git
  93. npm install --production
  94. cd ../..
  95. }
  96. # 5. Add Windows batch scripts
  97. function add_batch_scripts (){
  98. echo "Adding batch scripts"
  99. cp windows_scripts/*.bat atompm-portable/
  100. }
  101. # 6. Add manual
  102. function add_manual(){
  103. echo "Adding manual"
  104. manual_filename="atompm-userguide.pdf"
  105. curl $manual_url -o $manual_filename
  106. cp $manual_filename atompm-portable/
  107. rm $manual_filename
  108. }
  109. ###MAIN######
  110. if [ ! -d ./atompm-portable/platform/PortablePython27 ]; then
  111. get_PP
  112. fi
  113. if [ ! -d ./atompm-portable/platform/NodeJS ]; then
  114. get_nodejs
  115. fi
  116. if [ ! -d ./atompm-portable/platform/GoogleChromePortable ]; then
  117. get_chrome
  118. fi
  119. add_atompm
  120. add_batch_scripts
  121. add_manual
  122. rm atompm-portable.zip
  123. zip -r atompm-portable.zip atompm-portable/