OrangeFox-Recovery-Builder.yml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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: 12
  77. - name: Build Environment
  78. run: |
  79. sudo apt update
  80. sudo apt -y upgrade
  81. rm -rf scripts
  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'
  87. run: |
  88. mkdir -p ${GITHUB_WORKSPACE}/OrangeFox
  89. cd ${GITHUB_WORKSPACE}/OrangeFox
  90. git config --global user.name "Samuel Kendall"
  91. git config --global user.email "kinguser981@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 }} ./${{ github.event.inputs.DEVICE_PATH }}
  99. cd ${{ github.event.inputs.DEVICE_PATH }}
  100. echo "COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV
  101. - name: Check Manifest Branch
  102. uses: haya14busa/action-cond@v1
  103. id: fox_branch
  104. with:
  105. cond: ${{ github.event.inputs.MANIFEST_BRANCH == '11.0' || github.event.inputs.MANIFEST_BRANCH == '12.1' }}
  106. if_true: lunch twrp_${{ github.event.inputs.DEVICE_NAME }}-eng && make clean && mka adbd ${{ github.event.inputs.BUILD_TARGET }}image
  107. if_false: lunch omni_${{ github.event.inputs.DEVICE_NAME }}-eng && make clean && mka ${{ github.event.inputs.BUILD_TARGET }}image
  108. - name: Building OrangeFox
  109. run: |
  110. cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  111. set +e
  112. source build/envsetup.sh
  113. export ALLOW_MISSING_DEPENDENCIES=true
  114. set -e
  115. ${{ steps.fox_branch.outputs.value }}
  116. - name: Set Build Date # For Build Date Info, currently using Asia/Manila
  117. run: |
  118. echo "BUILD_DATE=$(TZ=Asia/Manila date +%Y%m%d)" >> $GITHUB_ENV
  119. - name: Check if Recovery Exist
  120. run: |
  121. cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  122. if [ -f out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img ]; then
  123. echo "CHECK_IMG_IS_OK=true" >> $GITHUB_ENV
  124. echo "MD5_IMG=$(md5sum out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img | cut -d ' ' -f 1)" >> $GITHUB_ENV
  125. else
  126. echo "Recovery out directory is empty."
  127. fi
  128. if [ -f out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.zip ]; then
  129. echo "CHECK_ZIP_IS_OK=true" >> $GITHUB_ENV
  130. echo "MD5_ZIP=$(md5sum out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.zip | cut -d ' ' -f 1)" >> $GITHUB_ENV
  131. else
  132. echo "Recovery out directory is empty."
  133. fi
  134. - name: Include Recovery Installer
  135. run: |
  136. if [ ${{ github.event.inputs.RECOVERY_INSTALLER }} = true ]; then
  137. cd OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/
  138. wget https://github.com/kinguser981/recovery-installer/releases/download/zip/recovery-installer.zip
  139. mv OrangeFox*.img recovery.img
  140. zip -ur recovery-installer.zip recovery.img
  141. fi
  142. continue-on-error: true
  143. - name: Recovery to tar for Samsung devices
  144. run: |
  145. if [ ${{ github.event.inputs.RECOVERY_TAR }} = true ]; then
  146. cd OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/
  147. mv OrangeFox*.img recovery.img
  148. tar -cvf recovery.tar recovery.img
  149. fi
  150. continue-on-error: true
  151. - name: Upload to Release
  152. if: env.CHECK_IMG_IS_OK == 'true' && env.CHECK_ZIP_IS_OK == 'true'
  153. uses: softprops/action-gh-release@v1
  154. with:
  155. files: |
  156. OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery.img
  157. OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery.tar
  158. OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery-installer.zip
  159. name: Unofficial OrangeFox for ${{ github.event.inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
  160. tag_name: ${{ github.run_id }}
  161. body: |
  162. Build: ${{ github.event.inputs.MANIFEST_BRANCH }}
  163. Device: [Device Tree/Branch](${{ github.event.inputs.DEVICE_TREE }}/tree/${{ github.event.inputs.DEVICE_TREE_BRANCH }})
  164. Commit: Most recent [commit](${{ github.event.inputs.DEVICE_TREE }}/commit/${{ env.COMMIT_ID }}) during building.
  165. MD5 (img): ${{ env.MD5_IMG }}
  166. MD5 (zip): ${{ env.MD5_ZIP }}
  167. MD5 (tar): ${{ env.MD5_TAR }}
  168. - name: Release ramdisk-recovery
  169. uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981
  170. with:
  171. files: |
  172. OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/obj/PACKAGING/vendor_ramdisk_fragments_intermediates/recovery.*
  173. OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/ramdisk-recovery.*
  174. name: ${{ github.event.inputs.DEVICE_NAME }} (TWRP)
  175. tag_name: ${{ github.run_id }}
  176. body: |
  177. Manifest: ${{ github.event.inputs.MANIFEST_BRANCH }}
  178. Target: ${{ github.event.inputs.BUILD_TARGET}}.img
  179. - name: Run LDCheck
  180. run: |
  181. cd tools
  182. mv -n libneeds ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
  183. mv -n ldcheck ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
  184. cd ../workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root
  185. python3 ldcheck -p system/lib64:vendor/lib64:system/lib:vendor/lib -d ${{ github.event.inputs.LDCHECK }}
  186. echo "Done checking missing dependencies. Review, and reconfigure your tree."
  187. continue-on-error: true