Skip to content

Commit

Permalink
Create Recovery-Builder-SHRP.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
carlodandan authored Dec 10, 2022
1 parent b29b9f8 commit 13e8cda
Showing 1 changed file with 197 additions and 0 deletions.
197 changes: 197 additions & 0 deletions .github/workflows/Recovery-Builder-SHRP.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
name: Recovery Builder - SHRP

# Credits to:
# https://github.com/that1 for ldcheck and libneeds script
# https://github.com/TeamWin for QCom' Decryption Guide
# https://github.com/minimal-manifest-twrp for TWRP Manifest
# https://github.com/azwhikaru for Recovery Builder Template
# And all Contributors in every repositories I used

on:
workflow_dispatch:
inputs:
MANIFEST_URL:
description: 'Manifest'
required: true
default: ''
type: choice
options:
- https://github.com/SHRP/manifest.git
MANIFEST_BRANCH:
description: 'Manifest Branch'
required: true
default: ''
type: choice
options:
- shrp-12.1
- v3_11.0
DEVICE_TREE:
description: 'Custom Recovery Tree' # Your already made Device Tree for TWRP
required: true
default: 'https://github.com/cd-Spidey/custom_recovery_tree_xiaomi_cannong'
DEVICE_TREE_BRANCH:
description: 'Custom Recovery Tree Branch' # Your Device Tree Branch, make sure it's right.
required: true
default: 'Android-S'
DEVICE_PATH:
description: 'Specify your Device Path' # As is, just like your DEVICE_PATH in your BoardConfig.mk
required: true
default: 'device/realme/nashc'
DEVICE_NAME:
description: 'Specify your Device Codename' # As is, just like your PRODUCT_DEVICE in your device tree.
required: true
default: 'nashc'
MAKEFILE_NAME:
description: 'Specify your Makefile Name' # Look for twrp_ or omni_codename.mk, just remove the .mk
required: true
default: 'twrp_nashc'
BUILD_TARGET:
description: 'Specify your Build Target' # Pick among boot, recovery and vendor_boot
required: true
default: 'recovery'
type: choice
options:
- boot
- recovery
- vendorboot
FILE_TO_CHECK:
description: 'Specify which libs to check' # Use it know what kind of dependencies your missing for decryption.
required: true
default: 'system/bin/qseecomd' # Mainly for QCOM. but can also work in mtk... I guess.

jobs:
build:
if: github.event.repository.owner.id == github.event.sender.id
runs-on: ubuntu-20.04
steps:
- name: Check Out
uses: actions/[email protected]

- name: Display Inputs
run: |
echo "Displaying variables/inputs."
echo "Manifest URL: ${{ github.event.inputs.MANIFEST_URL }}"
echo "Manifest Branch: ${{ github.event.inputs.MANIFEST_BRANCH }}"
echo "Device Tree: ${{ github.event.inputs.DEVICE_TREE }}"
echo "Device Branch: ${{ github.event.inputs.DEVICE_TREE_BRANCH }}"
echo "Device Path: ${{ github.event.inputs.DEVICE_PATH }}"
echo "Device Name: ${{ github.event.inputs.DEVICE_NAME }}"
echo "Makefile Name: ${{ github.event.inputs.MAKEFILE_NAME }}"
echo "Build Target: ${{ github.event.inputs.BUILD_TARGET }}image"
- name: Cleanup
uses: rokibhasansagar/slimhub_actions@main

- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 12

- name: Prepare the Environment
run: |
sudo apt update
sudo apt -y upgrade
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-gtk3-dev libxml2 lzop pngcrush schedtool squashfs-tools imagemagick libbz2-dev lzma ncftp qemu-user-static libstdc++-10-dev python
- name: Install OpenJDK
run: |
git clone https://github.com/cd-Spidey/Random.git ./opendjk
sudo bash opendjk/setup/packages/open_jdk.sh
- name: Install Git-Repo
run: |
git config --global advice.detachedHead false
git clone https://android.googlesource.com/tools/repo -b v2.29 ~/bin
chmod a+x ~/bin/repo
sudo ln -sf ~/bin/repo /usr/bin/repo
- name: Initialize Repo
run: |
mkdir workspace
cd workspace
echo "workdir=$(pwd)" >> $GITHUB_OUTPUT
git config --global user.name "Carlo Dandan"
git config --global user.email "[email protected]"
repo init --depth=1 -u ${{ github.event.inputs.MANIFEST_URL }} -b ${{ github.event.inputs.MANIFEST_BRANCH }}
id: pwd

- name: Repo Sync
run: |
repo sync -j$(nproc --all) --force-sync
working-directory: workspace

- name: Clone Device Tree
run: |
git clone ${{ github.event.inputs.DEVICE_TREE }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.DEVICE_PATH }}
working-directory: ${{ steps.pwd.outputs.workdir }}

- name: Check Build Tree
uses: haya14busa/action-cond@v1
id: buildtree
with:
cond: ${{ github.event.inputs.MANIFEST_BRANCH == 'twrp-11' || github.event.inputs.MANIFEST_BRANCH == 'twrp-12.1' }}
if_true: twrp
if_false: omni

- name: Sync Dependencies
run: |
bash ${GITHUB_WORKSPACE}/scripts/convert.sh ${{ github.event.inputs.DEVICE_PATH }}/${{ steps.buildtree.outputs.value }}.dependencies
repo sync -j$(nproc --all)
working-directory: ${{ steps.pwd.outputs.workdir }}
continue-on-error: true

- name: Building Recovery
run: |
source build/envsetup.sh
export ALLOW_MISSING_DEPENDENCIES=true
lunch ${{ github.event.inputs.MAKEFILE_NAME }}-eng && make clean && make ${{ github.event.inputs.BUILD_TARGET }}image -j$(nproc --all)
echo "Done building your ${{ github.event.inputs.BUILD_TARGET }}.img"
working-directory: ${{ steps.pwd.outputs.workdir }}

- name: Set Properties # Output will be use in final name of recovery.
id: props
run: |
echo "date=$(date +%Y%m%d)" >> $GITHUB_OUTPUT
- name: Renaming into SHRP
run: |
cd out/target/product/${{ github.event.inputs.DEVICE_NAME }}
mv ${{ github.event.inputs.BUILD_TARGET }}.img ${{ github.event.inputs.MANIFEST_BRANCH }}_3.1.0-v000-${{ github.event.inputs.DEVICE_NAME }}-${{ steps.props.outputs.date }}.img
echo "Done renaming into ${{ github.event.inputs.MANIFEST_BRANCH }}_3.1.0-v000-${{ github.event.inputs.DEVICE_NAME }}-${{ steps.props.outputs.date }}.img"
working-directory: ${{ steps.pwd.outputs.workdir }}

- name: Upload to Release
uses: ncipollo/[email protected]
with:
artifacts: workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/${{ github.event.inputs.MANIFEST_BRANCH }}*.img
name: Unofficial SHRP for ${{ github.event.inputs.DEVICE_NAME }} - Build ${{ steps.props.outputs.date }} / ${{ github.run_id }}
draft: false
prerelease: true
tag: ${{ github.run_id }}-${{ steps.props.outputs.date }}
token: ${{ secrets.GITHUB_TOKEN }}
body: |
Device: ${{ github.event.inputs.DEVICE_NAME }}
Manifest: ${{ github.event.inputs.MANIFEST_URL }} -b ${{ github.event.inputs.MANIFEST_BRANCH }}
Status: Alpha - Test it Yourself.
- name: Link of Release
run: |
echo "Here is your newly-built Custom Recovery."
echo "https://github.com/${GITHUB_REPOSITORY}/releases/tag/${{ github.run_id }}-${{ steps.props.outputs.date }}"
- name: Clone LDChecker
run: |
git clone https://github.com/cd-Spidey/Random ./ldcheck
cd ldcheck/extract-tools
mv -n qseecomd ${GITHUB_WORKSPACE}/workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/system/bin/
mv -n libneeds ${GITHUB_WORKSPACE}/workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
mv -n ldcheck ${GITHUB_WORKSPACE}/workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
echo "Done moving essentials in checking missing dependencies."
continue-on-error: true

- name: Run LDCheck
run: |
cd workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root
python3 ldcheck -p system/lib64:vendor/lib64:system/lib:vendor/lib -d ${{ github.event.inputs.FILE_TO_CHECK }}
echo "Done checking missing dependencies. Review, and reconfigure your tree."
continue-on-error: true

0 comments on commit 13e8cda

Please sign in to comment.