OrangeFox-Recovery-Builder.yml 9.6 KB

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