OrangeFox-Recovery-Builder.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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/Poco-F3-GT-Tree-for-twrp.git'
  18. DEVICE_TREE_BRANCH:
  19. description: 'Custom Recovery Tree Branch'
  20. required: true
  21. default: 'Poco_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 Samsung 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: Clean-up
  73. uses: rokibhasansagar/slimhub_actions@main
  74. - name: Swap Space
  75. uses: pierotofy/set-swap-space@master
  76. with:
  77. swap-size-gb: 24
  78. - name: Build Environment
  79. run: |
  80. sudo apt update
  81. sudo apt -y upgrade
  82. git clone https://gitlab.com/OrangeFox/misc/scripts
  83. cd scripts
  84. sudo bash setup/android_build_env.sh
  85. - name: Set-up Manifest
  86. if: github.event.inputs.MANIFEST_BRANCH == '11.0' || github.event.inputs.MANIFEST_BRANCH == '12.1' || github.event.inputs.MANIFEST_BRANCH == '14.1'
  87. run: |
  88. mkdir -p ${GITHUB_WORKSPACE}/OrangeFox
  89. cd ${GITHUB_WORKSPACE}/OrangeFox
  90. git config --global user.name "ツ๛abrohim๛"
  91. git config --global user.email "callofduty.pubg786@gmail.com"
  92. git clone https://gitlab.com/OrangeFox/sync.git
  93. cd sync
  94. ./orangefox_sync.sh --branch ${{ github.event.inputs.MANIFEST_BRANCH }} --path ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  95. - name: Clone Device Tree
  96. run: |
  97. cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  98. git clone ${{ github.event.inputs.DEVICE_TREE }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./device/xiaomi/ares
  99. cd device/xiaomi/ares
  100. echo "COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV
  101. - name: Fix BoardConfig.mk
  102. run: |
  103. cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/device/xiaomi/ares
  104. sed -i 's/mi_ext //g' BoardConfig.mk
  105. sed -i 's/BOARD_XIAOMI_DYNAMIC_PARTITIONS_PARTITION_LIST := system vendor product mi_ext system_ext/BOARD_XIAOMI_DYNAMIC_PARTITIONS_PARTITION_LIST := system vendor product system_ext/g' BoardConfig.mk
  106. - name: Add TeamWin Dependencies
  107. run: |
  108. mkdir -p ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/.repo/local_manifests
  109. cat > ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/.repo/local_manifests/teamwin.xml <<EOF
  110. <?xml version="1.0" encoding="UTF-8"?>
  111. <manifest>
  112. <project name="TeamWin/android_bootable_recovery" path="bootable/recovery" remote="github" revision="android-12.1" />
  113. <project name="TeamWin/android_system_vold" path="system/vold" remote="github" revision="android-12.1" />
  114. </manifest>
  115. EOF
  116. cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  117. repo sync -c --force-sync --no-clone-bundle --no-tags -j$(nproc --all)
  118. - name: Deep Clean Recovery Intermediate Files
  119. run: |
  120. cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  121. rm -rf out/target/product/${{ github.event.inputs.DEVICE_NAME }}/obj/PACKAGING/recovery_intermediates/
  122. rm -rf out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/
  123. echo "Cleaned recovery intermediate directories"
  124. - name: Building OrangeFox
  125. run: |
  126. cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  127. set +e
  128. rm -rf out
  129. make clean
  130. source build/envsetup.sh
  131. export ALLOW_MISSING_DEPENDENCIES=true
  132. export LC_ALL=C
  133. lunch twrp_${{ github.event.inputs.DEVICE_NAME }}-eng
  134. m bootimage
  135. set -e
  136. # Rest of your existing steps remain the same...
  137. - name: Set Build Date
  138. run: |
  139. echo "BUILD_DATE=$(date +%Y%m%d)" >> $GITHUB_ENV
  140. DEVICE_TREE_URL="${{ github.event.inputs.DEVICE_TREE }}"
  141. if [[ "${DEVICE_TREE_URL}" == *.git ]]; then
  142. DEVICE_TREE_URL="${DEVICE_TREE_URL%.git}"
  143. fi
  144. echo "DEVICE_TREE_URL=${DEVICE_TREE_URL}" >> $GITHUB_ENV
  145. - name: Check if Recovery Exist
  146. run: |
  147. cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  148. if [ -f out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img ]; then
  149. echo "CHECK_IMG_IS_OK=true" >> $GITHUB_ENV
  150. echo "FILE_PATH=${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}" >> $GITHUB_ENV
  151. echo "MD5_IMG=$(md5sum out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img | cut -d ' ' -f 1)" >> $GITHUB_ENV
  152. elif [ -f out/target/product/${{ github.event.inputs.DEVICE_NAME }}/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img ]; then
  153. echo "CHECK_IMG_IS_OK=true" >> $GITHUB_ENV
  154. 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
  155. 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
  156. else
  157. echo "Recovery out directory is empty."
  158. cd Exit
  159. fi
  160. - name: Rename the Recovery
  161. run: |
  162. cd ${{ env.FILE_PATH }}/
  163. if [ "${{ github.event.inputs.BUILD_TARGET }}" = "boot" ]; then
  164. mv OrangeFox*.img boot.img
  165. echo "RECOVERY_TYPE=boot" >> $GITHUB_ENV
  166. echo "boot.img file found!"
  167. elif [ "${{ github.event.inputs.BUILD_TARGET }}" = "recovery" ]; then
  168. mv OrangeFox*.img recovery.img
  169. echo "RECOVERY_TYPE=recovery" >> $GITHUB_ENV
  170. echo "recovery.img file found!"
  171. elif [ "${{ github.event.inputs.BUILD_TARGET }}" = "vendorboot" ]; then
  172. mv OrangeFox*.img vendor_boot.img
  173. echo "RECOVERY_TYPE=vendor_boot" >> $GITHUB_ENV
  174. echo "vendor_boot.img file found!"
  175. else
  176. echo "No Recovery file found!"
  177. fi
  178. continue-on-error: true
  179. - name: Include Recovery Installer
  180. run: |
  181. if [ ${{ github.event.inputs.RECOVERY_INSTALLER }} = true ]; then
  182. cd ${{ env.FILE_PATH }}/
  183. wget https://github.com/abrohim0786/recovery-installer/releases/download/11256427880/recovery-installer.zip
  184. zip -ur recovery-installer.zip ${{ env.RECOVERY_TYPE }}.img
  185. fi
  186. continue-on-error: true
  187. - name: Recovery to tar for Samsung devices
  188. run: |
  189. if [ ${{ github.event.inputs.RECOVERY_TAR }} = true ]; then
  190. cd ${{ env.FILE_PATH }}/
  191. tar -cvf ${{ env.RECOVERY_TYPE }}.tar ${{ env.RECOVERY_TYPE }}.img
  192. fi
  193. continue-on-error: true
  194. - name: Upload to Release
  195. if: env.CHECK_IMG_IS_OK == 'true'
  196. uses: softprops/action-gh-release@v1
  197. with:
  198. files: |
  199. ${{ env.FILE_PATH }}/${{ env.RECOVERY_TYPE }}.img
  200. ${{ env.FILE_PATH }}/${{ env.RECOVERY_TYPE }}.tar
  201. ${{ env.FILE_PATH }}/recovery-installer.zip
  202. ${{ env.FILE_PATH }}/OrangeFox*.zip
  203. name: Unofficial OrangeFox for ${{ github.event.inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
  204. tag_name: ${{ github.run_id }}
  205. body: |
  206. Build: ${{ github.event.inputs.MANIFEST_BRANCH }}
  207. Device: [Device Tree/Branch](${{ github.event.inputs.DEVICE_TREE }}/tree/${{ github.event.inputs.DEVICE_TREE_BRANCH }})
  208. Commit: Most recent [commit](${{ github.event.inputs.DEVICE_TREE }}/commit/${{ env.COMMIT_ID }}) during building.
  209. - name: Release ramdisk-recovery
  210. if: env.CHECK_IMG_IS_OK == 'true'
  211. uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981
  212. with:
  213. files: |
  214. ${{ env.FILE_PATH }}/obj/PACKAGING/vendor_ramdisk_fragments_intermediates/recovery.*
  215. ${{ env.FILE_PATH }}/ramdisk-recovery.*
  216. name: Unofficial OrangeFox for ${{ github.event.inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
  217. tag_name: ${{ github.run_id }}
  218. body: |
  219. Target: ${{ env.RECOVERY_TYPE }}.img
  220. Build: ${{ github.event.inputs.MANIFEST_BRANCH }}
  221. Device: [Device Tree/Branch](${{ env.DEVICE_TREE_URL }}/tree/${{ inputs.DEVICE_TREE_BRANCH }})
  222. Commit: Most recent [commit](${{ env.DEVICE_TREE_URL }}/commit/${{ env.COMMIT_ID }}) during building.
  223. MD5 (img): ${{ env.MD5_IMG }}
  224. - name: Run LDCheck
  225. run: |
  226. cd tools
  227. mv -n libneeds ${{ env.FILE_PATH }}/recovery/root/
  228. mv -n ldcheck ${{ env.FILE_PATH }}/recovery/root/
  229. cd ${{ env.FILE_PATH }}/recovery/root/
  230. python3 ldcheck -p system/lib64:vendor/lib64:system/lib:vendor/lib -d ${{ github.event.inputs.LDCHECK }}
  231. echo "Done checking missing dependencies. Review, and reconfigure your tree."
  232. continue-on-error: true