OrangeFox-Recovery-Builder.yml 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. name: OrangeFox - Build
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. MANIFEST_BRANCH:
  6. description: 'OrangeFox Branch'
  7. required: true
  8. default: '12.1'
  9. type: choice
  10. options:
  11. - 14.1
  12. - 12.1
  13. - 11.0
  14. DEVICE_TREE:
  15. description: 'Custom Recovery Tree'
  16. required: true
  17. default: 'https://github.com/abrohim0786/ofox_device_xiaomi_ares.git'
  18. DEVICE_TREE_BRANCH:
  19. description: 'Custom Recovery Tree Branch'
  20. required: true
  21. default: 'fox_12.1'
  22. DEVICE_PATH:
  23. description: 'Specify your device path.'
  24. required: true
  25. default: 'device/xiaomi/ares'
  26. DEVICE_NAME:
  27. description: 'Specify your Device Codename.'
  28. required: true
  29. default: 'ares'
  30. BUILD_TARGET:
  31. description: 'Specify your Build Target'
  32. required: true
  33. default: 'boot'
  34. type: choice
  35. options:
  36. - boot
  37. - recovery
  38. - vendorboot
  39. LDCHECK:
  40. description: 'Path of blobs to check'
  41. required: true
  42. default: 'system/bin/qseecomd'
  43. RECOVERY_TAR:
  44. description: 'Release recovery.tar For Xiaomi devices'
  45. required: false
  46. default: false
  47. type: boolean
  48. RECOVERY_INSTALLER:
  49. description: 'Include recovery installer zip'
  50. type: boolean
  51. required: true
  52. default: true
  53. jobs:
  54. build:
  55. name: Build OFRP by ${{ github.actor }}
  56. runs-on: ubuntu-latest
  57. if: github.event.repository.owner.id == github.event.sender.id
  58. env:
  59. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  60. permissions:
  61. contents: write
  62. steps:
  63. - name: Checkout
  64. uses: actions/checkout@v3
  65. - name: Display Inputs
  66. run: |
  67. echo "::group::User Environment Variables"
  68. echo "Displaying variables/inputs."
  69. echo "Include Recovery Installer: ${{ github.event.inputs.RECOVERY_INSTALLER }}"
  70. echo "Release recovery.tar For Samsung devices: ${{ github.event.inputs.RECOVERY_TAR }}"
  71. echo "::endgroup::"
  72. - name: Builder Info
  73. run: |
  74. echo "::group::👷 Builder Identity"
  75. echo "Built with ❤️ by: 😄 ツ๛abrohim๛"
  76. echo "::endgroup::"
  77. - name: Clean-up
  78. uses: rokibhasansagar/slimhub_actions@main
  79. - name: Swap Space
  80. uses: pierotofy/set-swap-space@master
  81. with:
  82. swap-size-gb: 24
  83. - name: Build Environment
  84. run: |
  85. sudo apt update
  86. sudo apt -y upgrade
  87. git clone https://gitlab.com/OrangeFox/misc/scripts
  88. cd scripts
  89. sudo bash setup/android_build_env.sh
  90. - name: Set-up Manifest
  91. if: github.event.inputs.MANIFEST_BRANCH == '11.0' || github.event.inputs.MANIFEST_BRANCH == '12.1' || github.event.inputs.MANIFEST_BRANCH == '14.1'
  92. run: |
  93. mkdir -p ${GITHUB_WORKSPACE}/OrangeFox
  94. cd ${GITHUB_WORKSPACE}/OrangeFox
  95. git config --global user.name "abrohim0786"
  96. git config --global user.email "callofduty.pubg786@gmail.com"
  97. git clone https://gitlab.com/OrangeFox/sync.git
  98. cd sync
  99. ./orangefox_sync.sh --branch ${{ github.event.inputs.MANIFEST_BRANCH }} --path ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  100. - name: Clone Device Tree
  101. run: |
  102. cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  103. git clone https://github.com/abrohim0786/ofox_device_xiaomi_ares.git -b TWRP-12.1 ./device/xiaomi/ares
  104. cd device/xiaomi/ares
  105. echo "COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV
  106. - name: Check Manifest Branch
  107. uses: haya14busa/action-cond@v1
  108. id: fox_branch
  109. with:
  110. cond: ${{ github.event.inputs.MANIFEST_BRANCH == '11.0' || github.event.inputs.MANIFEST_BRANCH == '12.1' }}
  111. if_true: lunch twrp_${{ github.event.inputs.DEVICE_NAME }}-eng && make clean && mka adbd ${{ github.event.inputs.BUILD_TARGET }}image
  112. if_false: lunch omni_${{ github.event.inputs.DEVICE_NAME }}-eng && make clean && mka ${{ github.event.inputs.BUILD_TARGET }}image
  113. - name: Deep Clean Recovery Intermediate Files
  114. run: |
  115. cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  116. rm -rf out/target/product/${{ github.event.inputs.DEVICE_NAME }}/obj/PACKAGING/recovery_intermediates/
  117. rm -rf out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/
  118. echo "Cleaned recovery intermediate directories"
  119. - name: Building OrangeFox
  120. run: |
  121. cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  122. set +e
  123. source build/envsetup.sh
  124. export ALLOW_MISSING_DEPENDENCIES=true
  125. set -e
  126. ${{ steps.fox_branch.outputs.value }}
  127. - name: Set Build Date # Output will be use in Release
  128. run: |
  129. echo "BUILD_DATE=$(date +%Y%m%d)" >> $GITHUB_ENV
  130. DEVICE_TREE_URL="${{ github.event.inputs.DEVICE_TREE }}"
  131. if [[ "${DEVICE_TREE_URL}" == *.git ]]; then
  132. DEVICE_TREE_URL="${DEVICE_TREE_URL%.git}"
  133. fi
  134. echo "DEVICE_TREE_URL=${DEVICE_TREE_URL}" >> $GITHUB_ENV
  135. - name: Check if Recovery Exist
  136. run: |
  137. cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  138. if [ -f out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img ]; then
  139. echo "CHECK_IMG_IS_OK=true" >> $GITHUB_ENV
  140. echo "FILE_PATH=${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}" >> $GITHUB_ENV
  141. echo "MD5_IMG=$(md5sum out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img | cut -d ' ' -f 1)" >> $GITHUB_ENV
  142. elif [ -f out/target/product/${{ github.event.inputs.DEVICE_NAME }}/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img ]; then
  143. echo "CHECK_IMG_IS_OK=true" >> $GITHUB_ENV
  144. echo "FILE_PATH=${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/target/product/${{ github.event.inputs.DEVICE_NAME }}" >> $GITHUB_ENV
  145. echo "MD5_IMG=$(md5sum out/target/product/${{ github.event.inputs.DEVICE_NAME }}/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img | cut -d ' ' -f 1)" >> $GITHUB_ENV
  146. else
  147. echo "Recovery out directory is empty."
  148. cd Exit
  149. fi
  150. - name: Rename the Recovery
  151. run: |
  152. cd ${{ env.FILE_PATH }}/
  153. if [ "${{ github.event.inputs.BUILD_TARGET }}" = "boot" ]; then
  154. mv OrangeFox*.img boot.img
  155. echo "RECOVERY_TYPE=boot" >> $GITHUB_ENV
  156. echo "boot.img file found!"
  157. elif [ "${{ github.event.inputs.BUILD_TARGET }}" = "recovery" ]; then
  158. mv OrangeFox*.img recovery.img
  159. echo "RECOVERY_TYPE=recovery" >> $GITHUB_ENV
  160. echo "recovery.img file found!"
  161. elif [ "${{ github.event.inputs.BUILD_TARGET }}" = "vendorboot" ]; then
  162. mv OrangeFox*.img vendor_boot.img
  163. echo "RECOVERY_TYPE=vendor_boot" >> $GITHUB_ENV
  164. echo "vendor_boot.img file found!"
  165. else
  166. echo "No Recovery file found!"
  167. fi
  168. continue-on-error: true
  169. - name: Include Recovery Installer
  170. run: |
  171. if [ ${{ github.event.inputs.RECOVERY_INSTALLER }} = true ]; then
  172. cd ${{ env.FILE_PATH }}/
  173. wget https://github.com/kinguser981/recovery-installer/releases/download/11256427880/recovery-installer.zip
  174. zip -ur recovery-installer.zip ${{ env.RECOVERY_TYPE }}.img
  175. fi
  176. continue-on-error: true
  177. - name: Recovery to tar for Samsung devices
  178. run: |
  179. if [ ${{ github.event.inputs.RECOVERY_TAR }} = true ]; then
  180. cd ${{ env.FILE_PATH }}/
  181. tar -cvf ${{ env.RECOVERY_TYPE }}.tar ${{ env.RECOVERY_TYPE }}.img
  182. fi
  183. continue-on-error: true
  184. - name: Upload to Release
  185. if: env.CHECK_IMG_IS_OK == 'true'
  186. uses: softprops/action-gh-release@v1
  187. with:
  188. files: |
  189. ${{ env.FILE_PATH }}/${{ env.RECOVERY_TYPE }}.img
  190. ${{ env.FILE_PATH }}/${{ env.RECOVERY_TYPE }}.tar
  191. ${{ env.FILE_PATH }}/recovery-installer.zip
  192. ${{ env.FILE_PATH }}/OrangeFox*.zip
  193. name: Unofficial OrangeFox for ${{ github.event.inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
  194. tag_name: ${{ github.run_id }}
  195. body: |
  196. Build: ${{ github.event.inputs.MANIFEST_BRANCH }}
  197. Device: [Device Tree/Branch](${{ github.event.inputs.DEVICE_TREE }}/tree/${{ github.event.inputs.DEVICE_TREE_BRANCH }})
  198. Commit: Most recent [commit](${{ github.event.inputs.DEVICE_TREE }}/commit/${{ env.COMMIT_ID }}) during building.
  199. - name: Release ramdisk-recovery
  200. if: env.CHECK_IMG_IS_OK == 'true'
  201. uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981
  202. with:
  203. files: |
  204. ${{ env.FILE_PATH }}/obj/PACKAGING/vendor_ramdisk_fragments_intermediates/recovery.*
  205. ${{ env.FILE_PATH }}/ramdisk-recovery.*
  206. name: Unofficial OrangeFox for ${{ github.event.inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
  207. tag_name: ${{ github.run_id }}
  208. body: |
  209. Target: ${{ env.RECOVERY_TYPE }}.img
  210. Build: ${{ github.event.inputs.MANIFEST_BRANCH }}
  211. Device: [Device Tree/Branch](${{ env.DEVICE_TREE_URL }}/tree/${{ inputs.DEVICE_TREE_BRANCH }})
  212. Commit: Most recent [commit](${{ env.DEVICE_TREE_URL }}/commit/${{ env.COMMIT_ID }}) during building.
  213. MD5 (img): ${{ env.MD5_IMG }}
  214. - name: Run LDCheck
  215. run: |
  216. cd tools
  217. mv -n libneeds ${{ env.FILE_PATH }}/recovery/root/
  218. mv -n ldcheck ${{ env.FILE_PATH }}/recovery/root/
  219. cd ${{ env.FILE_PATH }}/recovery/root/
  220. python3 ldcheck -p system/lib64:vendor/lib64:system/lib:vendor/lib -d ${{ github.event.inputs.LDCHECK }}
  221. echo "Done checking missing dependencies. Review, and reconfigure your tree."
  222. continue-on-error: true