OrangeFox-Recovery-Builder.yml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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. 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 # Output will be use in Release
  117. run: |
  118. echo "BUILD_DATE=$(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. - name: Rename the Recovery
  129. run: |
  130. cd OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/
  131. mv OrangeFox*.img recovery.img
  132. continue-on-error: true
  133. - name: Include Recovery Installer
  134. run: |
  135. if [ ${{ github.event.inputs.RECOVERY_INSTALLER }} = true ]; then
  136. cd OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/
  137. wget https://github.com/kinguser981/recovery-installer/releases/download/zip/recovery-installer.zip
  138. zip -ur recovery-installer.zip recovery.img
  139. fi
  140. continue-on-error: true
  141. - name: Recovery to tar for Samsung devices
  142. run: |
  143. if [ ${{ github.event.inputs.RECOVERY_TAR }} = true ]; then
  144. cd OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/
  145. tar -cvf recovery.tar recovery.img
  146. fi
  147. continue-on-error: true
  148. - name: Upload to Release
  149. if: env.CHECK_IMG_IS_OK == 'true'
  150. uses: softprops/action-gh-release@v1
  151. with:
  152. files: |
  153. OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery.img
  154. OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery.tar
  155. OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery-installer.zip
  156. name: Unofficial OrangeFox for ${{ github.event.inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
  157. tag_name: ${{ github.run_id }}
  158. body: |
  159. Build: ${{ github.event.inputs.MANIFEST_BRANCH }}
  160. Device: [Device Tree/Branch](${{ github.event.inputs.DEVICE_TREE }}/tree/${{ github.event.inputs.DEVICE_TREE_BRANCH }})
  161. Commit: Most recent [commit](${{ github.event.inputs.DEVICE_TREE }}/commit/${{ env.COMMIT_ID }}) during building.
  162. MD5 (img): ${{ env.MD5_IMG }}
  163. MD5 (zip): ${{ env.MD5_ZIP }}
  164. MD5 (tar): ${{ env.MD5_TAR }}
  165. - name: Release ramdisk-recovery
  166. uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981
  167. with:
  168. files: |
  169. OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/obj/PACKAGING/vendor_ramdisk_fragments_intermediates/recovery.*
  170. OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/ramdisk-recovery.*
  171. name: ${{ github.event.inputs.DEVICE_NAME }} (TWRP)
  172. tag_name: ${{ github.run_id }}
  173. body: |
  174. Manifest: ${{ github.event.inputs.MANIFEST_BRANCH }}
  175. Target: ${{ github.event.inputs.BUILD_TARGET}}.img
  176. - name: Run LDCheck
  177. run: |
  178. cd tools
  179. mv -n libneeds ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
  180. mv -n ldcheck ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
  181. cd ../OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
  182. python3 ldcheck -p system/lib64:vendor/lib64:system/lib:vendor/lib -d ${{ github.event.inputs.LDCHECK }}
  183. echo "Done checking missing dependencies. Review, and reconfigure your tree."
  184. continue-on-error: true