Recovery Build #189
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: | |
type: choice | |
description: Manifest Branch | |
options: | |
- 12.1 | |
- 11 | |
required: true | |
default: 12.1 | |
DEVICE_TREE_URL: | |
description: Device Tree URL | |
required: true | |
default: https://gitlab.com/OrangeFox/device/lavender | |
DEVICE_TREE_BRANCH: | |
description: Device Tree Branch | |
required: true | |
default: fox_12.1 | |
DEVICE_PATH: | |
description: Path the device tree should be synced to, relative to source root | |
required: true | |
default: device/xiaomi/lavender | |
DEVICE_NAME: | |
description: Device Name from tree (should match name on twrp_<DEVICE_NAME>.mk) | |
required: true | |
default: lavender | |
BUILD_TARGET: | |
type: choice | |
description: Partition containing recovery ramdisk | |
options: | |
- boot | |
- recovery | |
- vendor_boot | |
required: true | |
default: recovery | |
OPTIONAL_FLAGS: | |
description: (Optional) Additional "FOX_" flags for build can be added here | |
required: false | |
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 Name: ${{ inputs.DEVICE_NAME }}" | |
echo "Build Target: ${{ inputs.BUILD_TARGET }}.img" | |
echo "::endgroup::" | |
# 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 build environment | |
run: | | |
sudo apt install git aria2 -y | |
git clone https://gitlab.com/OrangeFox/misc/scripts | |
cd scripts | |
sudo bash setup/android_build_env.sh | |
- name: Sync OrangeFox sources and minimal manifest | |
run: | | |
mkdir OrangeFox_sync | |
cd OrangeFox_sync | |
git clone https://gitlab.com/OrangeFox/sync.git | |
cd sync | |
./orangefox_sync.sh --branch ${{ inputs.MANIFEST_BRANCH }} --path ${{ github.workspace }}/fox_${{ inputs.MANIFEST_BRANCH }} | |
sed -i "s/TeamWin/OrangeFox/g" ${{ github.workspace }}/fox_${{ inputs.MANIFEST_BRANCH }}/vendor/twrp/build/tools/roomservice.py | |
- name: Place device trees and kernel | |
run: | | |
mkdir -p .repo/local_manifests | |
cp -f ${GITHUB_WORKSPACE}/templates/roomservice.xml .repo/local_manifests/ | |
REMOTE_NAME=$(grep -oP '(?<=://).*(?=\.)' <<< ${{ inputs.DEVICE_TREE_URL }}) | |
sed -i "s%\!--project name=\"{DEVICE_TREE_URL_REPO}%project name=\"$(grep -oP "(?<=${REMOTE_NAME}.com/).*" <<< ${{ inputs.DEVICE_TREE_URL }})%g" .repo/local_manifests/roomservice.xml | |
sed -i "s%{DEVICE_PATH}%${{ inputs.DEVICE_PATH }}%g" .repo/local_manifests/roomservice.xml | |
sed -i "s%{DEVICE_REMOTE_NAME}%${REMOTE_NAME}%g" .repo/local_manifests/roomservice.xml | |
sed -i "s%{DEVICE_TREE_BRANCH}\"/-->%${{ inputs.DEVICE_TREE_BRANCH }}\"/>%g" .repo/local_manifests/roomservice.xml | |
repo sync ${{ inputs.DEVICE_PATH }} -j$(nproc --all) | |
DT_NAME=$(awk -F/ '{print $NF}' <<< ${{ inputs.DEVICE_TREE_URL }}) | |
if [ "$DT_NAME" != ${{ inputs.DEVICE_NAME }} ]; then | |
if [ -z "$(ls ${{ inputs.DEVICE_PATH }}/${{ inputs.DEVICE_NAME }}/BoardConfig.mk)" ]; then | |
mkdir ${{ inputs.DEVICE_PATH }}/${{ inputs.DEVICE_NAME }} | |
DT_BoardConfig=$(ls ${{ inputs.DEVICE_PATH }}/BoardConfig* | head -1) | |
echo -e "-include ${DT_BoardConfig}">${{ inputs.DEVICE_PATH }}/${{ inputs.DEVICE_NAME }}/BoardConfig.mk | |
fi | |
fi | |
working-directory: fox_${{ inputs.MANIFEST_BRANCH }} | |
- name: Build it | |
run: | | |
set +e | |
source build/envsetup.sh | |
set -e | |
export ALLOW_MISSING_DEPENDENCIES=true | |
export FOX_BUILD_DEVICE=${{ inputs.DEVICE_NAME }} | |
export LC_ALL="C" | |
if [ -n "${{ inputs.OPTIONAL_FLAGS}}" ]; then | |
${{ inputs.OPTIONAL_FLAGS }} | |
echo -e "Additional Command(s): ${{ inputs.OPTIONAL_FLAGS }}" | |
else | |
echo "No additional commands specified." | |
fi | |
lunch twrp_${{ inputs.DEVICE_NAME }}-eng && mka $(tr -d _ <<< ${{ inputs.BUILD_TARGET }})image | |
working-directory: fox_${{ inputs.MANIFEST_BRANCH }} | |
- name: Upload to Release | |
uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981 | |
with: | |
files: | | |
fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ inputs.DEVICE_NAME }}/*${{ inputs.DEVICE_NAME }}* | |
fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ inputs.DEVICE_NAME }}/obj/PACKAGING/vendor_ramdisk_fragments_intermediates/recovery.* | |
fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ inputs.DEVICE_NAME }}/ramdisk-recovery.* | |
name: | | |
${{ inputs.DEVICE_NAME }} (OrangeFox) | |
tag_name: ${{ github.run_id }} | |
body: | | |
Manifest: ${{ inputs.MANIFEST_BRANCH }} | |
Target: ${{ inputs.BUILD_TARGET }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |