upload_native.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/bash
  2. set -euo pipefail
  3. # This shell script runs only during continuous integration at TravisCI.
  4. # Its purpose is to commit native libraries to the project's GitHub repo.
  5. function native_changes_common() {
  6. echo " - Configuring GIT user"
  7. git config --global user.email "travis-ci"
  8. git config --global user.name "travis-ci"
  9. echo " - Decrypting private key"
  10. openssl aes-256-cbc -K $encrypted_f0a0b284e2e8_key -iv $encrypted_f0a0b284e2e8_iv -in private/key.enc -out "$HOME/.ssh/id_rsa" -d
  11. chmod 600 "$HOME/.ssh/id_rsa"
  12. # ls jme3-bullet-native/build/libs/bulletjme/shared/
  13. # md5 -r jme3-bullet-native/libs/native/osx/x86/libbulletjme.dylib jme3-bullet-native/build/libs/bulletjme/shared/mac32/libbulletjme.dylib
  14. echo " - Pushing natives onto branch $TRAVIS_BRANCH"
  15. git checkout "$TRAVIS_BRANCH"
  16. }
  17. echo " - Checking if natives changed in commit $TRAVIS_COMMIT.."
  18. NATIVE_CHANGES_BULLET="$(git diff-tree --name-only "$TRAVIS_COMMIT" -- jme3-bullet-native/)"
  19. NATIVE_CHANGES_ANDROID_BULLET="$(git diff-tree --name-only "$TRAVIS_COMMIT" -- jme3-bullet-native-android/)"
  20. NATIVE_CHANGES_ANDROID_NATIVES="$(git diff-tree --name-only "$TRAVIS_COMMIT" -- jme3-android-native/)"
  21. if [ "$NATIVE_CHANGES_BULLET" != "" ]; then
  22. echo " - Found changes in jme3-bullet-native"
  23. native_changes_common
  24. git add -v -- jme3-bullet-native/libs/native/
  25. git status
  26. echo " - Commit changes in jme3-bullet-native"
  27. git commit -v -m "[ci skip] bullet: update $TRAVIS_OS_NAME natives"
  28. git pull -q --rebase
  29. echo " - Push changes in jme3-bullet-native"
  30. git push [email protected]:jMonkeyEngine/jmonkeyengine.git
  31. else
  32. echo " - No changes in jme3-bullet-native"
  33. fi
  34. if [ "$NATIVE_CHANGES_ANDROID_BULLET" != "" ]; then
  35. echo " - Found changes in jme3-bullet-native-android"
  36. native_changes_common
  37. git add -v -- jme3-bullet-native-android/libs/
  38. git status
  39. echo " - Commit changes in jme3-bullet-native-android"
  40. git commit -v -m "[ci skip] android bullet: update natives"
  41. git pull -q --rebase
  42. echo " - Push changes in jme3-bullet-native-android"
  43. git push [email protected]:jMonkeyEngine/jmonkeyengine.git
  44. else
  45. echo " - No changes in jme3-bullet-native-android"
  46. fi
  47. if [ "$NATIVE_CHANGES_ANDROID_NATIVES" != "" ]; then
  48. echo " - Found changes in jme3-android-native"
  49. native_changes_common
  50. git add -v -- jme3-android-native/libs/
  51. git status
  52. echo " - Commmit changes in jme3-android-native"
  53. git commit -v -m "[ci skip] android: update natives"
  54. git pull -q --rebase
  55. echo " - Push changes in jme3-android-native"
  56. git push [email protected]:jMonkeyEngine/jmonkeyengine.git
  57. else
  58. echo " - No changes in jme3-android-native"
  59. fi