OrangeFox-Recovery-Builder.yml 8.1 KB

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