221 lines
8.3 KiB
YAML
221 lines
8.3 KiB
YAML
name: PitchBlack [PBRP]
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
MANIFEST_BRANCH:
|
|
description: 'PBRP Manifest Branch'
|
|
required: true
|
|
default: ''
|
|
type: choice
|
|
options:
|
|
- android-14.0
|
|
- android-12.1
|
|
- android-11.0
|
|
- android-10.0
|
|
- android-9.0
|
|
- android-8.1
|
|
- android-7.1
|
|
- android-6.0
|
|
DEVICE_TREE:
|
|
description: 'Custom Recovery Tree' # Your already made Device Tree for TWRP
|
|
required: true
|
|
default: 'https://github.com/enter_username/repo_name'
|
|
DEVICE_TREE_BRANCH:
|
|
description: 'Your Custom Recovery Tree Branch' # Your Device Tree Branch, make sure it's right.
|
|
required: true
|
|
default: 'main'
|
|
DEVICE_NAME:
|
|
description: 'Specify your Device Codename' # As is, just like your PRODUCT_DEVICE in your device tree.
|
|
required: true
|
|
default: '7304X'
|
|
DEVICE_PATH:
|
|
description: 'Specify your Device Path (Check the DEVICE_PATH in BoardConfig.mk)' # As is, just like your DEVICE_PATH in your BoardConfig.mk
|
|
required: true
|
|
default: 'device/device`s_company/Codename'
|
|
BUILD_TARGET:
|
|
description: 'Specify your Build Target (choose "pbrp" instead of "recovery" for Android 11 or above)' # Pick among boot, recovery and vendor_boot
|
|
required: true
|
|
default: 'recovery'
|
|
type: choice
|
|
options:
|
|
- pbrp
|
|
- boot
|
|
- recovery
|
|
- vendorboot
|
|
LDCHECK:
|
|
description: 'Use LDCHECK'
|
|
required: false
|
|
default: 'false'
|
|
type: boolean
|
|
LDCHECKPATH:
|
|
description: 'Path of blobs to check' # Use it know what kind of dependencies your missing for decryption blobs.
|
|
required: true
|
|
default: 'system/bin/qseecomd'
|
|
|
|
jobs:
|
|
build:
|
|
name: Build PBRP by ${{ github.actor }}
|
|
runs-on: ubuntu-20.04
|
|
if: github.event.repository.owner.id == github.event.sender.id
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
OUTPUT_DIR: ${{ github.workspace }}/android-recovery/out/target/product/${{ inputs.DEVICE_NAME }}
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Check Out
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Cleanup
|
|
uses: rokibhasansagar/slimhub_actions@main
|
|
|
|
- name: Set Swap Space
|
|
uses: pierotofy/set-swap-space@master
|
|
with:
|
|
swap-size-gb: 24
|
|
|
|
- name: Check Manifest Branch
|
|
run: |
|
|
if [ ${{ inputs.MANIFEST_BRANCH }} == 'android-11.0' ] || [ ${{ inputs.MANIFEST_BRANCH }} == 'android-12.1' ]; then
|
|
echo "CHECK_LEGACY_BRANCH=false" >> $GITHUB_ENV
|
|
else
|
|
echo "CHECK_LEGACY_BRANCH=true" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Prepare the environment
|
|
run: |
|
|
sudo add-apt-repository universe
|
|
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 libtinfo5 libgflags-dev libncurses5 python3
|
|
|
|
- name: Install OpenJDK
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'zulu'
|
|
java-version: '8'
|
|
|
|
- name: Install Git-Repo
|
|
run: |
|
|
mkdir ~/bin
|
|
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
|
|
chmod a+x ~/bin/repo
|
|
sudo ln -sf ~/bin/repo /usr/bin/repo
|
|
|
|
- name: Initialize Repo
|
|
run: |
|
|
mkdir android-recovery
|
|
pushd android-recovery
|
|
git config --global user.name "${{ github.actor }}"
|
|
git config --global user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
|
|
repo init --depth=1 -u https://github.com/PitchBlackRecoveryProject/manifest_pb.git -b ${{ inputs.MANIFEST_BRANCH }}
|
|
popd
|
|
|
|
- name: Repo Sync
|
|
run: |
|
|
pushd android-recovery
|
|
repo sync -j$(nproc --all) --force-sync
|
|
popd
|
|
|
|
- name: Clone Device Tree
|
|
run: |
|
|
pushd android-recovery
|
|
git clone ${{ inputs.DEVICE_TREE }} -b ${{ inputs.DEVICE_TREE_BRANCH }} ./${{ inputs.DEVICE_PATH }}
|
|
cd ${{ inputs.DEVICE_PATH }}
|
|
echo "COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV
|
|
popd
|
|
|
|
- name: Check Build Makefile
|
|
run: |
|
|
pushd android-recovery
|
|
if [ -f ${{ inputs.DEVICE_PATH }}/twrp_${{ inputs.DEVICE_NAME}}.mk ]; then
|
|
echo "DEVICE_MAKEFILE=twrp_${{ inputs.DEVICE_NAME }}" >> $GITHUB_ENV
|
|
elif [ -f ${{ inputs.DEVICE_PATH }}/omni_${{ inputs.DEVICE_NAME}}.mk ]; then
|
|
echo "DEVICE_MAKEFILE=omni_${{ inputs.DEVICE_NAME }}" >> $GITHUB_ENV
|
|
elif [ -f ${{ inputs.DEVICE_PATH }}/pb_${{ inputs.DEVICE_NAME}}.mk ]; then
|
|
echo "DEVICE_MAKEFILE=pb_${{ inputs.DEVICE_NAME }}" >> $GITHUB_ENV
|
|
else
|
|
echo "No recovery makefile file found!"
|
|
fi
|
|
popd
|
|
continue-on-error: true
|
|
|
|
- name: Installing python2 for legacy builds
|
|
if: env.CHECK_LEGACY_BRANCH == 'true'
|
|
run: |
|
|
sudo apt-get install python2 python-is-python2
|
|
|
|
- name: Fixed Missing Fonts
|
|
run: |
|
|
cd android-recovery
|
|
mkdir external/noto-fonts/other && cd external/noto-fonts/other
|
|
wget https://github.com/cd-Crypton/custom-recovery-extras/raw/main/missing-font.zip
|
|
unzip -o missing-font.zip
|
|
|
|
- name: Building PitchBlack
|
|
run: |
|
|
pushd android-recovery
|
|
source build/envsetup.sh
|
|
export ALLOW_MISSING_DEPENDENCIES=true
|
|
if [ "${{ inputs.BUILD_TARGET }}" != "pbrp" ]; then
|
|
lunch ${{ env.DEVICE_MAKEFILE }}-eng && mka ${{ inputs.BUILD_TARGET }}image
|
|
else
|
|
lunch ${{ env.DEVICE_MAKEFILE }}-eng && mka ${{ inputs.BUILD_TARGET }}
|
|
fi
|
|
popd
|
|
|
|
- name: Set Build Date # Needed for gh-releases
|
|
run: |
|
|
echo "BUILD_DATE=$(TZ=UTC date +%Y%m%d)" >> $GITHUB_ENV
|
|
|
|
|
|
- name: Check if the recovery exists
|
|
if: always()
|
|
run: |
|
|
img_file=$(find "${{ env.OUTPUT_DIR }}" -name "*.img" -print -quit)
|
|
zip_file=$(find "${{ env.OUTPUT_DIR }}" -name "PBRP*.zip" -print -quit)
|
|
if [ -f "$img_file" ]; then
|
|
echo "CHECK_IMG_IS_OK=true" >> $GITHUB_ENV
|
|
echo "MD5_IMG=$(md5sum "$img_file" | cut -d ' ' -f 1)" >> $GITHUB_ENV
|
|
else
|
|
echo "Recovery out directory is empty."
|
|
fi
|
|
if [ -f "$zip_file" ]; then
|
|
echo "CHECK_ZIP_IS_OK=true" >> $GITHUB_ENV
|
|
echo "MD5_ZIP=$(md5sum "$zip_file" | cut -d ' ' -f 1)" >> $GITHUB_ENV
|
|
else
|
|
echo "::warning::The zip file isn't present but make sure the image is from only after 100% completion in build stage"
|
|
fi
|
|
|
|
- name: Upload to Release
|
|
if: always() && (env.CHECK_IMG_IS_OK == 'true' || env.CHECK_ZIP_IS_OK == 'true')
|
|
uses: softprops/action-gh-release@master
|
|
with:
|
|
files: |
|
|
if [ "${{ inputs.BUILD_TARGET }}" != "pbrp" ]; then
|
|
${{ env.OUTPUT_DIR }}/${{ inputs.BUILD_TARGET }}*.img
|
|
else
|
|
${{ env.OUTPUT_DIR }}/recovery*.img
|
|
fi
|
|
${{ env.OUTPUT_DIR }}/PBRP*.zip
|
|
${{ env.OUTPUT_DIR }}/ramdisk-recovery.*
|
|
name: Unofficial PBRP for ${{ inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
|
|
tag_name: ${{ github.run_id }}
|
|
body: |
|
|
Build: ${{ inputs.MANIFEST_BRANCH }}
|
|
Device: [Device Tree/Branch](${{ inputs.DEVICE_TREE }}/tree/${{ inputs.DEVICE_TREE_BRANCH }})
|
|
Commit: Most recent [commit](${{ inputs.DEVICE_TREE }}/commit/${{ env.COMMIT_ID }}) during building.
|
|
prerelease: true
|
|
|
|
- name: Run LDCheck
|
|
if: inputs.LDCHECK == 'true'
|
|
run: |
|
|
cd tools
|
|
mv -n libneeds ${{ env.OUTPUT_DIR }}/${{ inputs.DEVICE_NAME }}/recovery/root/
|
|
mv -n ldcheck ${{ env.OUTPUT_DIR }}/${{ inputs.DEVICE_NAME }}/recovery/root/
|
|
cd ${{ env.OUTPUT_DIR }}/${{ inputs.DEVICE_NAME }}/recovery/root
|
|
python3 ldcheck -p system/lib64:vendor/lib64:system/lib:vendor/lib -d ${{ inputs.LDCHECKPATH }}
|
|
echo "Done checking missing dependencies. Review, and reconfigure your tree."
|
|
continue-on-error: true
|