Recovery Build #168
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Recovery Build | |
on: | |
workflow_dispatch: | |
inputs: | |
MANIFEST_BRANCH: | |
description: Manifest Branch | |
required: true | |
default: android-12.1 | |
DEVICE_TREE_URL: | |
description: Device Tree URL | |
required: true | |
default: https://github.com/PitchBlackRecoveryProject/android_device_infinix_X6739-pbrp | |
DEVICE_TREE_BRANCH: | |
description: Device Tree Branch | |
required: true | |
default: android-12.1 | |
DEVICE_PATH: | |
description: Path the device tree should be synced to, relative to source root | |
required: true | |
default: device/infinix/X6739 | |
DEVICE_MAKEFILE: | |
description: 'Name of device-specific makefile from tree (format: <PREFIX>_<DEVICE_NAME>)' | |
required: true | |
default: pb_X6739 | |
BUILD_TARGET: | |
type: choice | |
description: Partition containing recovery ramdisk | |
options: | |
- boot | |
- recovery | |
- vendor_boot | |
required: true | |
default: recovery | |
jobs: | |
build: | |
if: github.event.repository.owner.id == github.event.sender.id | |
runs-on: ubuntu-20.04 | |
# You can use either of the ubuntu-20.04 or ubuntu-22.04 runner | |
steps: | |
- name: Display Run Parameters | |
run: | | |
echo "::group::User Environment Variables" | |
echo "Manifest Branch: ${{ inputs.MANIFEST_BRANCH }}" | |
echo "Device Tree URL: ${{ inputs.DEVICE_TREE_URL }}" | |
echo "Device Tree Branch: ${{ inputs.DEVICE_TREE_BRANCH }}" | |
echo "Device Path: ${{ inputs.DEVICE_PATH }}" | |
echo "Device Makefile: ${{ inputs.DEVICE_MAKEFILE }}.mk" | |
echo "Build Target: ${{ inputs.BUILD_TARGET }}.img" | |
echo "::endgroup::" | |
- name: Identify Vendor | |
run: echo -e "prefix=$(awk -F_ '{print $1}' <<< ${{ inputs.DEVICE_MAKEFILE }})" >> ${GITHUB_OUTPUT} | |
id: vendorname | |
- name: Identify Device | |
run: echo -e "device=$(grep -oP '(?<=_).*' <<< ${{ inputs.DEVICE_MAKEFILE }})" >> ${GITHUB_OUTPUT} | |
id: devicename | |
# You might want to Checkout your repo first, but not mandatory | |
- name: Check Out | |
uses: actions/checkout@v4 | |
# Cleanup The Actions Workspace Using Custom Composite Run Actions | |
- name: Cleanup | |
uses: rokibhasansagar/slimhub_actions@main | |
# That's it! Now use your normal steps | |
- name: Set Swap Space | |
uses: pierotofy/set-swap-space@master | |
with: | |
swap-size-gb: 24 | |
- 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 libtinfo5 | |
sudo add-apt-repository universe | |
sudo apt -y install libncurses5 | |
- name: Install OpenJDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: 8 | |
- name: Install 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 workspace | |
cd workspace | |
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 -b ${{ inputs.MANIFEST_BRANCH }} | |
- name: Repo Sync | |
run: | | |
repo sync -j$(nproc --all) --force-sync | |
working-directory: workspace | |
- name: Clone device tree | |
run: | | |
git clone ${{ inputs.DEVICE_TREE_URL }} -b ${{ inputs.DEVICE_TREE_BRANCH }} ./${{ inputs.DEVICE_PATH }} | |
working-directory: workspace | |
- name: Sync Device Dependencies | |
run: | | |
bash ${GITHUB_WORKSPACE}/scripts/convert.sh ${{ inputs.DEVICE_PATH }}/${{ steps.vendorname.outputs.prefix }}.dependencies | |
repo sync -j$(nproc --all) | |
working-directory: workspace | |
continue-on-error: true | |
- name: Install Python 2 | |
run: | | |
sudo apt -y install python2 | |
- name: Building recovery | |
run: | | |
. build/envsetup.sh | |
lunch ${{ inputs.DEVICE_MAKEFILE }}-eng | |
mka pbrp | |
working-directory: workspace | |
- name: Upload to Release | |
uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981 | |
with: | |
files: | | |
workspace/out/target/product/${{ steps.devicename.outputs.device }}/${{ inputs.BUILD_TARGET }}.img | |
workspace/out/target/product/${{ steps.devicename.outputs.device }}/*${{ steps.devicename.outputs.device }}* | |
workspace/out/target/product/${{ steps.devicename.outputs.device }}/obj/PACKAGING/vendor_ramdisk_fragments_intermediates/recovery.* | |
workspace/out/target/product/${{ steps.devicename.outputs.device }}/ramdisk-recovery.* | |
name: ${{ steps.devicename.outputs.device}} (PBRP) | |
tag_name: ${{ github.run_id }} | |
body: | | |
Manifest: ${{ inputs.MANIFEST_BRANCH }} | |
Target: ${{ inputs.BUILD_TARGET }}.img | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |