config.yml 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. version: 2.1
  2. jobs:
  3. build:
  4. docker:
  5. - image: fr3akyphantom/droid-builder:edge
  6. environment:
  7. # GitHubMail: "" # Git User Email Address
  8. # GitHubName: "" # Git Username
  9. # GITHUB_TOKEN: '' # MUST BE SECRET & PUT IN CIRCLECI PROJECT ENV VARS
  10. VENDOR: 'BLU' # MANDATORY
  11. CODENAME: 'G0130WW' # MANDATORY
  12. FLAVOR: 'userdebug' # MANDATORY
  13. working_directory: /home/builder/android
  14. steps:
  15. - run:
  16. name: AIO Build
  17. command: |
  18. # SANITY CHECKS
  19. if [[ -z $GitHubMail ]]; then echo -e "You haven't configured GitHub E-Mail Address." && exit 1; fi
  20. if [[ -z $GitHubName ]]; then echo -e "You haven't configured GitHub Username." && exit 1; fi
  21. if [[ -z $GITHUB_TOKEN ]]; then echo -e "You haven't configured GitHub Token.\nWithout it, recovery can't be published." && exit 1; fi
  22. if [[ -z $VENDOR ]]; then echo -e "You haven't configured Vendor name." && exit 1; fi
  23. if [[ -z $CODENAME ]]; then echo -e "You haven't configured Device Codename." && exit 1; fi
  24. if [[ -z $FLAVOR ]]; then echo -e "Set as 'eng' or 'userdebug'." && exit 1; fi
  25. # Set GitAuth Infos"
  26. git config --global user.email $GitHubMail
  27. git config --global user.name $GitHubName
  28. git config --global credential.helper store
  29. git config --global color.ui true
  30. echo -e "\nSetup Google Cookies for Smooth googlesource Cloning\n"
  31. git clone -q "https://$GITHUB_TOKEN@github.com/$GitHubName/google-git-cookies.git" &> /dev/null
  32. bash google-git-cookies/setup_cookies.sh
  33. rm -rf google-git-cookies
  34. cd /home/builder/android
  35. echo -e "Initializing minimal manifest repo\n"
  36. repo init -q -u https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git -b twrp-9.0 --depth 1
  37. echo -e "\nRemoving Unimportant Darwin-specific Files from syncing"
  38. cd .repo/manifests
  39. find . -type f -name '*.xml' | xargs sed -i '/darwin/d'
  40. git commit -a -m "Magic" || true
  41. cd ../ && sed -i '/darwin/d' manifest.xml && cd ../
  42. echo -e "Fired-up minimal manifest repo sync,\nThis will take time...\n"
  43. repo sync -c -q --force-sync --no-clone-bundle --no-tags -j$(nproc --all)
  44. # Unshallow vendor_omni (Only for Unofficial Builds)
  45. echo -e "\nFixing Unofficial TWRP Build lunch error\n"
  46. repo forall vendor/omni -c "git fetch --unshallow omnirom android-9.0"
  47. # Retain "roomservice: Do not overwrite existing repositories"
  48. repo forall vendor/omni -c "git revert 718f4c2fd6890f5eaa2d4972b1c3f3f582b5da47 -Xtheirs --no-edit --no-commit"
  49. # Retain "roomservice: Do not overwrite existing devices"
  50. repo forall vendor/omni -c "git revert 380d19cea2857d5901d7e7163f65ccc66d7bbad7 -Xtheirs --no-edit --no-commit"
  51. # Add those retains into local commit
  52. repo forall vendor/omni -c "git commit -m 'Fix Build from forked/personal repos'"
  53. echo -e "\nGetting Device Tree on Place via git clone\n"
  54. git clone -q https://github.com/rokibhasansagar/android_device_BLU_G0130WW -b twrp-9.0 device/${VENDOR}/${CODENAME}
  55. echo -e "\nPreparing Delicious Lunch..."
  56. export ALLOW_MISSING_DEPENDENCIES=true
  57. source build/envsetup.sh
  58. lunch omni_${CODENAME}-${FLAVOR}
  59. export Today=$(date +%Y%m%d)
  60. echo -e "\nBuilding Started, Please wait patiently...\n"
  61. make -j$(nproc --all) recoveryimage
  62. echo -e "\nBuild Successful.\n"
  63. echo -e "\nReady to Deploy...\n"
  64. mkdir upload
  65. export version=$(cat bootable/recovery/variables.h | grep "define TW_MAIN_VERSION_STR" | cut -d '"' -f2)
  66. cp out/target/product/${CODENAME}/recovery.img upload/TWRP_v${version}-${CODENAME}-${Today}-Unofficial.img
  67. cp out/target/product/${CODENAME}/ramdisk-recovery.* upload/
  68. ls -lA upload/
  69. ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -n "Latest TWRP Release for $(echo $CODENAME)" -b "TWRP $(echo $version)" -delete twrp_v${version} upload/
  70. workflows:
  71. version: 2
  72. build_and_test:
  73. jobs:
  74. - build:
  75. filters:
  76. branches:
  77. only: 'twrp-9.0'
  78. context: personal-envs
  79. # if you are copy-pasting this script,
  80. # set $GitHubMail, $GitHubName and $GITHUB_TOKEN in the environment variables