Skip to content

Recovery Build

Recovery Build #14

name: Recovery Build
on:
workflow_dispatch:
inputs:
MANIFEST_URL:
description: "MANIFEST_URL"
required: true
default: "https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp.git"
MANIFEST_BRANCH:
description: "MANIFEST_BRANCH"
required: true
default: "twrp-12.1"
DEVICE_TREE_URL:
description: "DEVICE_TREE_URL"
required: true
default: "https://github.com/sakshiagrwal/device_xiaomi_spes-TWRP.git"
DEVICE_TREE_BRANCH:
description: "DEVICE_TREE_BRANCH"
required: true
default: "twrp-12.1"
DEVICE_PATH:
description: "DEVICE_PATH"
required: true
default: "device/xiaomi/spes"
DEVICE_NAME:
description: "DEVICE_NAME"
required: true
default: "spes"
MAKEFILE_NAME:
description: "MAKEFILE_NAME"
required: true
default: "twrp_spes"
BUILD_TARGET:
description: "BUILD_TARGET"
required: true
default: "boot"
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Display Run Parameters
run: |
echo "::group::User Environment Variables"
echo "Manifest URL: ${{ github.event.inputs.MANIFEST_URL }}"
echo "Manifest Branch: ${{ github.event.inputs.MANIFEST_BRANCH }}"
echo "Device Tree URL: ${{ github.event.inputs.DEVICE_TREE_URL }}"
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 "Makefile Name: ${{ github.event.inputs.MAKEFILE_NAME }}"
echo "Build Target: ${{ github.event.inputs.BUILD_TARGET }}.img"
echo "::endgroup::"
- name: Checkout
uses: actions/checkout@v4
- name: Cleanup
uses: rokibhasansagar/slimhub_actions@main
- name: Prepare Environment
run: |
sudo apt-get install -y gperf gcc-multilib gcc-10-multilib g++-multilib g++-10-multilib lib32ncurses5-dev x11proto-core-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc ccache lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk3.0-gtk3-dev lzop pngcrush schedtool squashfs-tools imagemagick libbz2-dev lzma ncftp qemu-user-static libstdc++-10-dev libncurses5
- name: Install OpenJDK
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "8"
- name: Install Repo
run: |
mkdir -p ~/.bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
chmod a+rx ~/.bin/repo
sudo ln -sf ~/.bin/repo /usr/bin/repo
- name: Initialize Repo
run: |
mkdir workspace
cd workspace
echo "workspace-folder=$(pwd)" >> $GITHUB_OUTPUT
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
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_URL }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.DEVICE_PATH }}
working-directory: ${{ steps.pwd.outputs.workspace-folder }}
- 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 Device 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.workspace-folder }}
continue-on-error: true
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 12
- name: Building Recovery
run: |
source build/envsetup.sh
lunch ${{ github.event.inputs.MAKEFILE_NAME }}-eng && make clean && make ${{ github.event.inputs.BUILD_TARGET }}image -j$(nproc --all)
working-directory: ${{ steps.pwd.outputs.workspace-folder }}
- name: Github Release
uses: softprops/action-gh-release@v2
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: |
### TeamWin Recovery Project v3.7.0
**_Device: ${{ github.event.inputs.DEVICE_NAME }}_**
**_Target: ${{ github.event.inputs.BUILD_TARGET }}.img_**
**_Device Tree: [URL](${{ github.event.inputs.DEVICE_TREE_URL }}/tree/${{ github.event.inputs.DEVICE_TREE_BRANCH }})_**
**_Manifest: [URL](${{ github.event.inputs.MANIFEST_URL }}/tree/${{ github.event.inputs.MANIFEST_BRANCH }})_**
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}