Recovery Build (Legacy).yml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. name: Recovery Build (Legacy)
  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_omni'
  9. MANIFEST_BRANCH:
  10. description: 'MANIFEST_BRANCH'
  11. required: true
  12. default: 'twrp-7.1'
  13. DEVICE_TREE_URL:
  14. description: 'DEVICE_TREE_URL'
  15. required: true
  16. default: 'https://github.com/ycly2333/android_device_EEBBK_H3000S-twrp'
  17. DEVICE_TREE_BRANCH:
  18. description: 'DEVICE_TREE_BRANCH'
  19. required: true
  20. default: 'twrp-7.1'
  21. DEVICE_PATH:
  22. description: 'DEVICE_PATH'
  23. required: true
  24. default: 'device/EEBBK/H3000S'
  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: 'H3000S'
  35. MAKEFILE_NAME:
  36. description: 'MAKEFILE_NAME'
  37. required: true
  38. default: 'omni_H3000S'
  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. permissions:
  48. contents: write
  49. steps:
  50. - name: Display Run Parameters
  51. run: |
  52. echo "::group::User Environment Variables"
  53. echo "Manifest URL: ${{ github.event.inputs.MANIFEST_URL }}"
  54. echo "Manifest Branch: ${{ github.event.inputs.MANIFEST_BRANCH }}"
  55. echo "Device Tree URL: ${{ github.event.inputs.DEVICE_TREE_URL }}"
  56. echo "Device Tree Branch: ${{ github.event.inputs.DEVICE_TREE_BRANCH }}"
  57. echo "Device Path: ${{ github.event.inputs.DEVICE_PATH }}"
  58. echo "Device Name: ${{ github.event.inputs.DEVICE_NAME }}"
  59. echo "Makefile Name: ${{ github.event.inputs.MAKEFILE_NAME }}"
  60. echo "Build Target: ${{ github.event.inputs.BUILD_TARGET }}.img"
  61. echo "::endgroup::"
  62. # You might want to Checkout your repo first, but not mandatory
  63. - name: Check Out
  64. uses: actions/checkout@v4
  65. # Cleanup The Actions Workspace Using Custom Composite Run Actions
  66. - name: Cleanup
  67. uses: rokibhasansagar/slimhub_actions@main
  68. # That's it! Now use your normal steps
  69. - name: Prepare the environment
  70. run: |
  71. sudo apt update && sudo apt upgrade -y
  72. DEBIAN_FRONTEND=noninteractive sudo apt install -yq \
  73. linux-modules-extra-$(uname -r) \
  74. gperf gcc-multilib gcc-10-multilib g++-multilib g++-10-multilib \
  75. libc6-dev lib32ncurses5-dev x11proto-core-dev libx11-dev tree lib32z-dev libgl1-mesa-dev libxml2-utils \
  76. xsltproc bc ccache lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev \
  77. libwxgtk3.0-gtk3-dev libxml2 lzop pngcrush schedtool squashfs-tools \
  78. imagemagick libbz2-dev lzma ncftp qemu-user-static libstdc++-10-dev libncurses5 python3 tar
  79. - name: Install OpenJDK
  80. uses: actions/setup-java@v4
  81. with:
  82. distribution: 'zulu'
  83. java-version: '11'
  84. - name: Setup SSH Keys
  85. if: ${{ startsWith(github.event.inputs.MANIFEST_URL, 'git@github.com') ||
  86. startsWith(github.event.inputs.DEVICE_TREE_URL, 'git@github.com') ||
  87. startsWith(github.event.inputs.COMMON_TREE_URL, 'git@github.com') }}
  88. uses: webfactory/ssh-agent@v0.9.0
  89. with:
  90. ssh-private-key: |
  91. ${{ secrets.SSH_PRIVATE_KEY }}
  92. - name: Install repo
  93. run: |
  94. mkdir ~/bin
  95. curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
  96. chmod a+x ~/bin/repo
  97. sudo ln -sf ~/bin/repo /usr/bin/repo
  98. - name: Initialize repo
  99. run: |
  100. mkdir workspace
  101. cd workspace
  102. echo "workspace-folder=$(pwd)" >> $GITHUB_OUTPUT
  103. git config --global user.name "azwhikaru"
  104. git config --global user.email "azwhikaru+37921907@github.com"
  105. repo init --depth=1 -u ${{ github.event.inputs.MANIFEST_URL }} -b ${{ github.event.inputs.MANIFEST_BRANCH }}
  106. id: pwd
  107. - name: Repo Sync
  108. run: |
  109. repo sync -j$(nproc --all) --force-sync
  110. working-directory: workspace
  111. - name: Clone device tree
  112. run: |
  113. git clone ${{ github.event.inputs.DEVICE_TREE_URL }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.DEVICE_PATH }}
  114. working-directory: ${{ steps.pwd.outputs.workspace-folder }}
  115. - name: Clone common tree
  116. if: |
  117. github.event.inputs.COMMON_TREE_URL != null
  118. && github.event.inputs.COMMON_PATH != null
  119. run: |
  120. git clone ${{ github.event.inputs.COMMON_TREE_URL }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.COMMON_PATH }}
  121. working-directory: ${{ steps.pwd.outputs.workspace-folder }}
  122. - name: Sync Device Dependencies
  123. run: |
  124. bash ${GITHUB_WORKSPACE}/scripts/convert.sh ${{ github.event.inputs.DEVICE_PATH }}/${{ steps.buildtree.outputs.value }}.dependencies
  125. repo sync -j$(nproc --all)
  126. working-directory: ${{ steps.pwd.outputs.workspace-folder }}
  127. continue-on-error: true
  128. - name: Set Swap Space
  129. uses: pierotofy/set-swap-space@master
  130. with:
  131. swap-size-gb: 12
  132. - name: Switch to Python2
  133. run: |
  134. sudo apt -y install python
  135. sudo rm -rf /usr/bin/python
  136. sudo ln -s /usr/bin/python2 /usr/bin/python
  137. # sudo ln -s /usr/bin/python3 /usr/bin/python3
  138. continue-on-error: true
  139. - name: Building recovery
  140. run: |
  141. source build/envsetup.sh
  142. export ALLOW_MISSING_DEPENDENCIES=true
  143. lunch ${{ github.event.inputs.MAKEFILE_NAME }}-eng && make clean && make ${{ github.event.inputs.BUILD_TARGET }}image -j$(nproc --all)
  144. working-directory: ${{ steps.pwd.outputs.workspace-folder }}
  145. - name: Upload to Release
  146. uses: softprops/action-gh-release@v2
  147. with:
  148. files: |
  149. workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/${{ github.event.inputs.BUILD_TARGET }}.img
  150. workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/*.zip
  151. workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/*vendor*.img
  152. name: ${{ github.event.inputs.DEVICE_NAME }}-${{ github.run_id }}
  153. tag_name: ${{ github.run_id }}
  154. body: |
  155. Manifest: ${{ github.event.inputs.MANIFEST_BRANCH }}
  156. Device: ${{ github.event.inputs.DEVICE_NAME }}
  157. Target: ${{ github.event.inputs.BUILD_TARGET }}.img
  158. env:
  159. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}