Skip to content

Recovery Build

Recovery Build #191

name: Recovery Build
on:
workflow_dispatch:
inputs:
MANIFEST_BRANCH:
description: Manifest Branch
required: true
default: v3_9.0
DEVICE_TREE_URL:
description: Device Tree URL
required: true
default: https://github.com/SHRP-Devices/device_samsung_d2x
DEVICE_TREE_BRANCH:
description: Device Tree Branch
required: true
default: android-9.0
DEVICE_PATH:
description: Path the device tree should be synced to, relative to source root
required: true
default: device/samsung/d2x
DEVICE_MAKEFILE:
description: 'Name of device-specific makefile from tree (format: <PREFIX>_<DEVICE_NAME>)'
required: true
default: omni_d2x
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/SHRP/manifest.git -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
if [ "${{ steps.vendorname.outputs.prefix }}" != "twrp" ]; then
cd /usr/bin
sudo ln -sf python2 python
fi
- name: Building recovery
run: |
export ALLOW_MISSING_DEPENDENCIES=true
. build/envsetup.sh
lunch ${{ inputs.DEVICE_MAKEFILE }}-eng
mka $(tr -d _ <<< ${{ inputs.BUILD_TARGET }})image
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}} (SHRP)
tag_name: ${{ github.run_id }}
body: |
Manifest: ${{ inputs.MANIFEST_BRANCH }}
Target: ${{ inputs.BUILD_TARGET }}.img
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}