package.sh 4.2 KB

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