OrangeFox-Compile.yml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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: 'Fox_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 "FILE_PATH=${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}" >> $GITHUB_ENV
  124. echo "MD5_IMG=$(md5sum out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img | cut -d ' ' -f 1)" >> $GITHUB_ENV
  125. elif [ -f out/target/product/${{ github.event.inputs.DEVICE_NAME }}/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img ]; then
  126. echo "CHECK_IMG_IS_OK=true" >> $GITHUB_ENV
  127. 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
  128. 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
  129. else
  130. echo "Recovery out directory is empty."
  131. cd Exit
  132. fi
  133. - name: Rename the Recovery
  134. run: |
  135. cd ${{ env.FILE_PATH }}/
  136. if [ "${{ github.event.inputs.BUILD_TARGET }}" = "boot" ]; then
  137. mv OrangeFox*.img boot.img
  138. echo "RECOVERY_TYPE=boot" >> $GITHUB_ENV
  139. echo "boot.img file found!"
  140. elif [ "${{ github.event.inputs.BUILD_TARGET }}" = "recovery" ]; then
  141. mv OrangeFox*.img recovery.img
  142. echo "RECOVERY_TYPE=recovery" >> $GITHUB_ENV
  143. echo "recovery.img file found!"
  144. elif [ "${{ github.event.inputs.BUILD_TARGET }}" = "vendorboot" ]; then
  145. mv OrangeFox*.img vendor_boot.img
  146. echo "RECOVERY_TYPE=vendor_boot" >> $GITHUB_ENV
  147. echo "vendor_boot.img file found!"
  148. else
  149. echo "No Recovery file found!"
  150. fi
  151. continue-on-error: true
  152. - name: Include Recovery Installer
  153. run: |
  154. if [ ${{ github.event.inputs.RECOVERY_INSTALLER }} = true ]; then
  155. cd ${{ env.FILE_PATH }}/
  156. wget https://github.com/kinguser981/recovery-installer/releases/download/11256427880/recovery-installer.zip
  157. zip -ur recovery-installer.zip ${{ env.RECOVERY_TYPE }}.img
  158. fi
  159. continue-on-error: true
  160. - name: Recovery to tar for Samsung devices
  161. run: |
  162. if [ ${{ github.event.inputs.RECOVERY_TAR }} = true ]; then
  163. cd ${{ env.FILE_PATH }}/
  164. tar -cvf ${{ env.RECOVERY_TYPE }}.tar ${{ env.RECOVERY_TYPE }}.img
  165. fi
  166. continue-on-error: true
  167. - name: Upload to Release
  168. if: env.CHECK_IMG_IS_OK == 'true'
  169. uses: softprops/action-gh-release@v1
  170. with:
  171. files: |
  172. ${{ env.FILE_PATH }}/${{ env.RECOVERY_TYPE }}.img
  173. ${{ env.FILE_PATH }}/${{ env.RECOVERY_TYPE }}.tar
  174. ${{ env.FILE_PATH }}/recovery-installer.zip
  175. ${{ env.FILE_PATH }}/OrangeFox*.zip
  176. name: Unofficial OrangeFox for ${{ github.event.inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
  177. tag_name: ${{ github.run_id }}
  178. body: |
  179. Build: ${{ github.event.inputs.MANIFEST_BRANCH }}
  180. Device: [Device Tree/Branch](${{ github.event.inputs.DEVICE_TREE }}/tree/${{ github.event.inputs.DEVICE_TREE_BRANCH }})
  181. Commit: Most recent [commit](${{ github.event.inputs.DEVICE_TREE }}/commit/${{ env.COMMIT_ID }}) during building.
  182. - name: Release ramdisk-recovery
  183. if: env.CHECK_IMG_IS_OK == 'true'
  184. uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981
  185. with:
  186. files: |
  187. ${{ env.FILE_PATH }}/obj/PACKAGING/vendor_ramdisk_fragments_intermediates/recovery.*
  188. ${{ env.FILE_PATH }}/ramdisk-recovery.*
  189. name: Unofficial OrangeFox for ${{ github.event.inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
  190. tag_name: ${{ github.run_id }}
  191. body: |
  192. Target: ${{ env.RECOVERY_TYPE }}.img
  193. Build: ${{ github.event.inputs.MANIFEST_BRANCH }}
  194. Device: [Device Tree/Branch](${{ github.event.inputs.DEVICE_TREE }}/tree/${{ github.event.inputs.DEVICE_TREE_BRANCH }})
  195. Commit: Most recent [commit](${{ github.event.inputs.DEVICE_TREE }}/commit/${{ env.COMMIT_ID }}) during building.
  196. MD5 (img): ${{ env.MD5_IMG }}
  197. - name: Run LDCheck
  198. run: |
  199. cd tools
  200. mv -n libneeds ${{ env.FILE_PATH }}/recovery/root/
  201. mv -n ldcheck ${{ env.FILE_PATH }}/recovery/root/
  202. cd ${{ env.FILE_PATH }}/recovery/root/
  203. python3 ldcheck -p system/lib64:vendor/lib64:system/lib:vendor/lib -d ${{ github.event.inputs.LDCHECK }}
  204. echo "Done checking missing dependencies. Review, and reconfigure your tree."
  205. continue-on-error: true