Recovery Build.yml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. name: Recovery Build
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. MANIFEST_URL:
  6. description: 'MANIFEST_URL (if not using SSH keys, use https:// URL)'
  7. required: true
  8. default: 'git@github.com:minimal-manifest-twrp/platform_manifest_twrp_aosp.git'
  9. MANIFEST_BRANCH:
  10. description: 'MANIFEST_BRANCH'
  11. required: true
  12. default: 'twrp-12.1'
  13. DEVICE_TREE_URL:
  14. description: 'DEVICE_TREE_URL'
  15. required: true
  16. default: 'https://github.com/TeamWin/android_device_asus_I003D'
  17. DEVICE_TREE_BRANCH:
  18. description: 'DEVICE_TREE_BRANCH'
  19. required: true
  20. default: 'android-12.1'
  21. DEVICE_PATH:
  22. description: 'DEVICE_PATH'
  23. required: true
  24. default: 'device/asus/I003D'
  25. COMMON_TREE_URL:
  26. description: 'COMMON_TREE_URL (if no common tree, leave blank)'
  27. required: false
  28. COMMON_PATH:
  29. description: 'COMMON_PATH (if no common tree, leave blank)'
  30. required: false
  31. DEVICE_NAME:
  32. description: 'DEVICE_NAME'
  33. required: true
  34. default: 'I003D'
  35. MAKEFILE_NAME:
  36. description: 'MAKEFILE_NAME'
  37. required: true
  38. default: 'twrp_I003D'
  39. BUILD_TARGET:
  40. description: 'BUILD_TARGET'
  41. required: true
  42. default: 'recovery'
  43. jobs:
  44. build:
  45. if: github.event.repository.owner.id == github.event.sender.id
  46. runs-on: ubuntu-18.04
  47. # You can use either of the ubuntu-18.04 or ubuntu-20.04 runner
  48. steps:
  49. - name: Display Run Parameters
  50. run: |
  51. echo "::group::User Environment Variables"
  52. echo "Manifest URL: ${{ github.event.inputs.MANIFEST_URL }}"
  53. echo "Manifest Branch: ${{ github.event.inputs.MANIFEST_BRANCH }}"
  54. echo "Device Tree URL: ${{ github.event.inputs.DEVICE_TREE_URL }}"
  55. echo "Device Tree Branch: ${{ github.event.inputs.DEVICE_TREE_BRANCH }}"
  56. echo "Device Name: ${{ github.event.inputs.DEVICE_NAME }}"
  57. echo "Build Target: ${{ github.event.inputs.BUILD_TARGET }}.img"
  58. echo "::endgroup::"
  59. # You might want to Checkout your repo first, but not mandatory
  60. - name: Check Out
  61. uses: actions/checkout@v3
  62. # Cleanup The Actions Workspace Using Custom Composite Run Actions
  63. - name: Cleanup
  64. uses: rokibhasansagar/slimhub_actions@main
  65. # That's it! Now use your normal steps
  66. - name: Prepare the environment
  67. run: |
  68. sudo apt update
  69. sudo apt -y upgrade
  70. sudo apt -y install gperf gcc-multilib gcc-10-multilib g++-multilib g++-10-multilib libc6-dev lib32ncurses5-dev x11proto-core-dev libx11-dev tree lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc bc ccache lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk3.0-dev libxml2 lzop pngcrush schedtool squashfs-tools imagemagick libbz2-dev lzma ncftp python qemu-user-static libstdc++-10-dev
  71. sudo apt-get update
  72. sudo apt-get -y install --reinstall build-essential
  73. - name: Install OpenJDK 7
  74. if: |
  75. github.event.inputs.MANIFEST_BRANCH == 'twrp-5.1'
  76. || github.event.inputs.MANIFEST_BRANCH == 'twrp-6.0'
  77. uses: actions/setup-java@v3
  78. with:
  79. distribution: 'zulu'
  80. java-version: '7'
  81. - name: Install OpenJDK 8
  82. if: |
  83. github.event.inputs.MANIFEST_BRANCH != 'twrp-5.1'
  84. && github.event.inputs.MANIFEST_BRANCH != 'twrp-6.0'
  85. uses: actions/setup-java@v3
  86. with:
  87. distribution: 'zulu'
  88. java-version: '8'
  89. - name: Verify Java Install
  90. run: java -version
  91. - name: Setup SSH Keys
  92. if: ${{ startsWith(github.event.inputs.MANIFEST_URL, 'git@github.com') }}
  93. uses: webfactory/ssh-agent@v0.5.4
  94. with:
  95. ssh-private-key: |
  96. ${{ secrets.SSH_PRIVATE_KEY }}
  97. - name: Set variables
  98. run: |
  99. echo "::set-output name=date::$(date +%F)"
  100. id: var
  101. - name: Install repo
  102. run: |
  103. mkdir ~/bin
  104. curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
  105. chmod a+x ~/bin/repo
  106. export PATH=~/bin:$PATH
  107. - name: Initialize repo
  108. run: |
  109. PATH=~/bin:$PATH
  110. mkdir workspace
  111. cd workspace
  112. echo "::set-output name=pwd::$(pwd)"
  113. git config --global user.name "Captain Throwback"
  114. git config --global user.email "captainthrowback@hotmail.com"
  115. repo init --depth=1 -u ${{ github.event.inputs.MANIFEST_URL }} -b ${{ github.event.inputs.MANIFEST_BRANCH }}
  116. id: pwd
  117. - name: Repo Sync
  118. run: |
  119. PATH=~/bin:$PATH
  120. cd workspace
  121. repo sync -j$(nproc --all) -f --force-sync
  122. ls -al
  123. - name: Clone device tree
  124. run: |
  125. PATH=~/bin:$PATH
  126. cd ${{ steps.pwd.outputs.pwd }}
  127. git clone ${{ github.event.inputs.DEVICE_TREE_URL }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.DEVICE_PATH }}
  128. - name: Clone common tree
  129. if: |
  130. github.event.inputs.COMMON_TREE_URL != null
  131. && github.event.inputs.COMMON_PATH != null
  132. run: |
  133. PATH=~/bin:$PATH
  134. cd ${{ steps.pwd.outputs.pwd }}
  135. git clone ${{ github.event.inputs.COMMON_TREE_URL }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.COMMON_PATH }}
  136. - name: Set Swap Space
  137. uses: pierotofy/set-swap-space@master
  138. with:
  139. swap-size-gb: 12
  140. - name: Check Build Branch - Step 1
  141. if: ${{ github.event.inputs.MANIFEST_BRANCH == 'twrp-12.1' }}
  142. run: |
  143. PATH=~/bin:$PATH
  144. cd ${{ steps.pwd.outputs.pwd }}
  145. source build/envsetup.sh
  146. repopick 5405 5540
  147. - name: Check Build Branch - Step 2
  148. if: ${{ github.event.inputs.MANIFEST_BRANCH == 'twrp-5.1' }}
  149. run: |
  150. PATH=~/bin:$PATH
  151. cd ${{ steps.pwd.outputs.pwd }}
  152. cd bootable/recovery
  153. git fetch https://gerrit.twrp.me/android_bootable_recovery refs/changes/29/5729/1 && git cherry-pick FETCH_HEAD
  154. - name: Building recovery
  155. run: |
  156. PATH=~/bin:$PATH
  157. cd ${{ steps.pwd.outputs.pwd }}
  158. source build/envsetup.sh
  159. lunch ${{ github.event.inputs.MAKEFILE_NAME }}-eng
  160. export ALLOW_MISSING_DEPENDENCIES=true
  161. make clean
  162. make ${{ github.event.inputs.BUILD_TARGET }}image -j$(nproc --all)
  163. - name: Upload to Release
  164. uses: softprops/action-gh-release@v1
  165. with:
  166. files: workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/${{ github.event.inputs.BUILD_TARGET }}.img
  167. name: ${{ github.event.inputs.DEVICE_NAME }}-${{ github.run_id }}
  168. tag_name: ${{ github.run_id }}
  169. body: |
  170. Manifest: ${{ github.event.inputs.MANIFEST_BRANCH }}
  171. Device: ${{ github.event.inputs.DEVICE_NAME }}
  172. Target: ${{ github.event.inputs.BUILD_TARGET }}.img
  173. env:
  174. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}