Skip to content

Recovery Builder - TWRP #5

Recovery Builder - TWRP

Recovery Builder - TWRP #5

name: Recovery Builder - TWRP
on:
workflow_dispatch:
inputs:
MANIFEST_BRANCH:
description: 'TWRP Minimal-Manifest Branch'
required: true
default: 'twrp-12.1'
type: choice
options:
- twrp-12.1
- twrp-11
DEVICE_TREE:
description: 'Custom Recovery Tree'
required: true
default: 'https://github.com/cd-Crypton/custom_recovery_tree_realme_macedonia'
DEVICE_TREE_BRANCH:
description: 'Custom Recovery Tree Branch'
required: true
default: 'twrp-12.1'
DEVICE_PATH:
description: 'Specify your Device Path'
required: true
default: 'device/realme/macedonia'
DEVICE_NAME:
description: 'Specify your Device Codename'
required: true
default: 'macedonia'
BUILD_TARGET:
description: 'Specify your Build Target'
required: true
default: 'recovery'
type: choice
options:
- boot
- recovery
- vendor_boot
jobs:
build:
name: Build TWRP by ${{ github.actor }}
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- name: Display Run Parameters
run: |
echo "Manifest Branch: ${{ github.event.inputs.MANIFEST_BRANCH }}"
echo "Device Tree: ${{ github.event.inputs.DEVICE_TREE }}"
echo "Device Tree Branch: ${{ github.event.inputs.DEVICE_TREE_BRANCH }}"
echo "Device Path: ${{ github.event.inputs.DEVICE_PATH }}"
echo "Device Name: ${{ github.event.inputs.DEVICE_NAME }}"
echo "Build Target: ${{ github.event.inputs.BUILD_TARGET }}"
- name: Check Out Repository
uses: actions/checkout@v3
- name: Prepare Environment
run: |
sudo apt update
sudo apt -y install gperf gcc-multilib g++-multilib libc6-dev lib32ncurses5-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc bc ccache libstdc++-10-dev python3
- name: Install OpenJDK 8
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'
- name: Install Git Repo Tool
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 }}@users.noreply.github.com"
repo init --depth=1 -u https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp -b ${{ github.event.inputs.MANIFEST_BRANCH }}
- name: Sync Repo
run: |
cd workspace
repo sync -j$(nproc --all) --force-sync
- name: Clone Device Tree
run: |
cd workspace
git clone ${{ github.event.inputs.DEVICE_TREE }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ${{ github.event.inputs.DEVICE_PATH }}
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 16
- name: Build Recovery
run: |
cd workspace
source build/envsetup.sh
export ALLOW_MISSING_DEPENDENCIES=true
lunch omni_${{ github.event.inputs.DEVICE_NAME }}-eng
make clean
make ${{ github.event.inputs.BUILD_TARGET }}image -j$(nproc --all)
- name: Upload to GitHub Releases
uses: softprops/action-gh-release@v1
with:
files: workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/${{ github.event.inputs.BUILD_TARGET }}.img
name: ${{ github.event.inputs.DEVICE_NAME }}-${{ github.run_id }}
tag_name: ${{ github.run_id }}
body: |
Manifest: ${{ github.event.inputs.MANIFEST_BRANCH }}
Device: ${{ github.event.inputs.DEVICE_NAME }}
Target: ${{ github.event.inputs.BUILD_TARGET }}.img
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}