Recovery Build.yml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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 Path: ${{ github.event.inputs.DEVICE_PATH }}"
  57. echo "Device Name: ${{ github.event.inputs.DEVICE_NAME }}"
  58. echo "Makefile Name: ${{ github.event.inputs.MAKEFILE_NAME }}"
  59. echo "Build Target: ${{ github.event.inputs.BUILD_TARGET }}.img"
  60. echo "::endgroup::"
  61. # You might want to Checkout your repo first, but not mandatory
  62. - name: Check Out
  63. uses: actions/checkout@v3
  64. # Cleanup The Actions Workspace Using Custom Composite Run Actions
  65. - name: Cleanup
  66. uses: rokibhasansagar/slimhub_actions@main
  67. # That's it! Now use your normal steps
  68. - name: Prepare the environment
  69. run: |
  70. sudo apt update
  71. sudo apt -y upgrade
  72. 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 qemu-user-static libstdc++-10-dev python
  73. - name: Install OpenJDK
  74. uses: actions/setup-java@v3
  75. with:
  76. distribution: 'zulu'
  77. java-version: '8'
  78. - name: Setup SSH Keys
  79. if: ${{ startsWith(github.event.inputs.MANIFEST_URL, 'git@github.com') }}
  80. uses: webfactory/ssh-agent@v0.5.4
  81. with:
  82. ssh-private-key: |
  83. ${{ secrets.SSH_PRIVATE_KEY }}
  84. - name: Set variables
  85. run: |
  86. echo "::set-output name=date::$(date +%F)"
  87. id: var
  88. - name: Install repo
  89. run: |
  90. mkdir ~/bin
  91. curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
  92. chmod a+x ~/bin/repo
  93. sudo ln -sf ~/bin/repo /usr/bin/repo
  94. - name: Initialize repo
  95. run: |
  96. mkdir workspace
  97. cd workspace
  98. echo "::set-output name=pwd::$(pwd)"
  99. git config --global user.name "Captain Throwback"
  100. git config --global user.email "captainthrowback@hotmail.com"
  101. repo init --depth=1 -u ${{ github.event.inputs.MANIFEST_URL }} -b ${{ github.event.inputs.MANIFEST_BRANCH }}
  102. id: pwd
  103. - name: Repo Sync
  104. run: |
  105. repo sync -j$(nproc --all) --force-sync
  106. working-directory: workspace
  107. - name: Clone device tree
  108. run: |
  109. git clone ${{ github.event.inputs.DEVICE_TREE_URL }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.DEVICE_PATH }}
  110. working-directory: ${{ steps.pwd.outputs.pwd }}
  111. - name: Clone common tree
  112. if: |
  113. github.event.inputs.COMMON_TREE_URL != null
  114. && github.event.inputs.COMMON_PATH != null
  115. run: |
  116. git clone ${{ github.event.inputs.COMMON_TREE_URL }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.COMMON_PATH }}
  117. working-directory: ${{ steps.pwd.outputs.pwd }}
  118. - name: Check Build Tree
  119. uses: haya14busa/action-cond@v1
  120. id: buildtree
  121. with:
  122. cond: ${{ github.event.inputs.MANIFEST_BRANCH == 'twrp-11' || github.event.inputs.MANIFEST_BRANCH == 'twrp-12.1' }}
  123. if_true: twrp
  124. if_false: omni
  125. - name: Sync Device Dependencies
  126. run: |
  127. bash ${GITHUB_WORKSPACE}/scripts/convert.sh ${{ github.event.inputs.DEVICE_PATH }}/${{ steps.buildtree.outputs.value }}.dependencies
  128. repo sync -j$(nproc --all)
  129. working-directory: ${{ steps.pwd.outputs.pwd }}
  130. continue-on-error: true
  131. - name: Set Swap Space
  132. uses: pierotofy/set-swap-space@master
  133. with:
  134. swap-size-gb: 12
  135. - name: Check Build Branch
  136. if: ${{ github.event.inputs.MANIFEST_BRANCH == 'twrp-12.1' }}
  137. run: |
  138. source build/envsetup.sh
  139. repopick 5405 5540
  140. working-directory: ${{ steps.pwd.outputs.pwd }}
  141. - name: Building recovery
  142. run: |
  143. source build/envsetup.sh
  144. export ALLOW_MISSING_DEPENDENCIES=true
  145. lunch ${{ github.event.inputs.MAKEFILE_NAME }}-eng && make clean && make ${{ github.event.inputs.BUILD_TARGET }}image -j$(nproc --all)
  146. working-directory: ${{ steps.pwd.outputs.pwd }}
  147. - name: Upload to Release
  148. uses: softprops/action-gh-release@v1
  149. with:
  150. files: workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/${{ github.event.inputs.BUILD_TARGET }}.img
  151. name: ${{ github.event.inputs.DEVICE_NAME }}-${{ github.run_id }}
  152. tag_name: ${{ github.run_id }}
  153. body: |
  154. Manifest: ${{ github.event.inputs.MANIFEST_BRANCH }}
  155. Device: ${{ github.event.inputs.DEVICE_NAME }}
  156. Target: ${{ github.event.inputs.BUILD_TARGET }}.img
  157. env:
  158. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}