Recovery Build.yml 6.2 KB

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