OrangeFox-Compile.yml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. name: OrangeFox - Build
  2. # Credits to:
  3. # https://github.com/TeamWin
  4. # https://gitlab.com/OrangeFox
  5. # https://github.com/azwhikaru for Recovery Builder Template
  6. # And all Contributors in every repositories I used
  7. on:
  8. workflow_dispatch:
  9. inputs:
  10. MANIFEST_BRANCH:
  11. description: 'OrangeFox Branch'
  12. required: true
  13. default: '12.1'
  14. type: choice
  15. options:
  16. - 12.1
  17. - 11.0
  18. DEVICE_TREE:
  19. description: 'Custom Recovery Tree'
  20. required: true
  21. default: 'https://github.com/kinguser981/cap_sprout_orangefox'
  22. DEVICE_TREE_BRANCH:
  23. description: 'Custom Recovery Tree Branch'
  24. required: true
  25. default: 'OrangeFox-12.1'
  26. DEVICE_PATH:
  27. description: 'Specify your device path.'
  28. required: true
  29. default: 'device/nokia/cap_sprout'
  30. DEVICE_NAME:
  31. description: 'Specify your Device Codename.'
  32. required: true
  33. default: 'cap_sprout'
  34. BUILD_TARGET:
  35. description: 'Specify your Build Target'
  36. required: true
  37. default: 'recovery'
  38. type: choice
  39. options:
  40. - boot
  41. - recovery
  42. - vendorboot
  43. jobs:
  44. build:
  45. name: Build OFRP by ${{ github.actor }}
  46. runs-on: ubuntu-latest
  47. if: github.event.repository.owner.id == github.event.sender.id
  48. env:
  49. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  50. permissions:
  51. contents: write
  52. steps:
  53. - name: Checkout
  54. uses: actions/checkout@v3
  55. - name: Clean-up
  56. uses: rokibhasansagar/slimhub_actions@main
  57. - name: Swap Space
  58. uses: pierotofy/set-swap-space@master
  59. with:
  60. swap-size-gb: 12
  61. - name: Build Environment
  62. run: |
  63. sudo apt install aria2 -y
  64. git clone https://gitlab.com/OrangeFox/misc/scripts
  65. cd scripts
  66. sudo bash setup/android_build_env.sh
  67. - name: Set-up Manifest
  68. if: github.event.inputs.MANIFEST_BRANCH == '11.0' || github.event.inputs.MANIFEST_BRANCH == '12.1'
  69. run: |
  70. mkdir -p ${GITHUB_WORKSPACE}/OrangeFox
  71. cd ${GITHUB_WORKSPACE}/OrangeFox
  72. git config --global user.name "Carlo Dandan"
  73. git config --global user.email "jasminecarlo01@gmail.com"
  74. git clone https://gitlab.com/OrangeFox/sync.git
  75. cd sync
  76. ./orangefox_sync.sh --branch ${{ github.event.inputs.MANIFEST_BRANCH }} --path ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  77. - name: Clone Device Tree
  78. run: |
  79. cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  80. git clone ${{ github.event.inputs.DEVICE_TREE }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.DEVICE_PATH }}
  81. cd ${{ github.event.inputs.DEVICE_PATH }}
  82. echo "COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV
  83. - name: Check Manifest Branch
  84. uses: haya14busa/action-cond@v1
  85. id: fox_branch
  86. with:
  87. cond: ${{ github.event.inputs.MANIFEST_BRANCH == '11.0' || github.event.inputs.MANIFEST_BRANCH == '12.1' }}
  88. if_true: lunch twrp_${{ github.event.inputs.DEVICE_NAME }}-eng && make clean && mka adbd ${{ github.event.inputs.BUILD_TARGET }}image
  89. if_false: lunch omni_${{ github.event.inputs.DEVICE_NAME }}-eng && make clean && mka ${{ github.event.inputs.BUILD_TARGET }}image
  90. - name: Building OrangeFox
  91. run: |
  92. cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  93. set +e
  94. source build/envsetup.sh
  95. export ALLOW_MISSING_DEPENDENCIES=true
  96. set -e
  97. ${{ steps.fox_branch.outputs.value }}
  98. - name: Set Build Date # For Build Date Info, currently using Asia/Manila
  99. run: |
  100. echo "BUILD_DATE=$(TZ=Asia/Manila date +%Y%m%d)" >> $GITHUB_ENV
  101. - name: Check if Recovery Exist
  102. run: |
  103. cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
  104. if [ -f out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img ]; then
  105. echo "CHECK_IMG_IS_OK=true" >> $GITHUB_ENV
  106. echo "MD5_IMG=$(md5sum out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img | cut -d ' ' -f 1)" >> $GITHUB_ENV
  107. else
  108. echo "Recovery out directory is empty."
  109. fi
  110. if [ -f out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.zip ]; then
  111. echo "CHECK_ZIP_IS_OK=true" >> $GITHUB_ENV
  112. echo "MD5_ZIP=$(md5sum out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.zip | cut -d ' ' -f 1)" >> $GITHUB_ENV
  113. else
  114. echo "Recovery out directory is empty."
  115. fi
  116. - name: Upload to Release
  117. if: env.CHECK_IMG_IS_OK == 'true' && env.CHECK_ZIP_IS_OK == 'true'
  118. uses: softprops/action-gh-release@v1
  119. with:
  120. files: |
  121. OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img
  122. OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.zip
  123. name: Unofficial OrangeFox for ${{ github.event.inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
  124. tag_name: ${{ github.run_id }}
  125. body: |
  126. Build: ${{ github.event.inputs.MANIFEST_BRANCH }}
  127. Device: [Device Tree/Branch](${{ github.event.inputs.DEVICE_TREE }}/tree/${{ github.event.inputs.DEVICE_TREE_BRANCH }})
  128. Commit: Most recent [commit](${{ github.event.inputs.DEVICE_TREE }}/commit/${{ env.COMMIT_ID }}) during building.
  129. MD5 (img): ${{ env.MD5_IMG }}
  130. MD5 (zip): ${{ env.MD5_ZIP }}