Skip to content

Commit

Permalink
更新 OrangeFox [OFRP].yml
Browse files Browse the repository at this point in the history
  • Loading branch information
momo54181 committed Oct 1, 2024
1 parent 1def3fa commit 3601213
Showing 1 changed file with 99 additions and 139 deletions.
238 changes: 99 additions & 139 deletions .github/workflows/OrangeFox [OFRP].yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,81 +3,76 @@ name: OrangeFox [OFRP]
on:
workflow_dispatch:
inputs:
SYNC_URL:
description: 'SYNC_URL'
required: true
default: 'https://github.com/momo54181/ofrp-sync.git'
MANIFEST_BRANCH:
description: 'OrangeFox Manifest Branch'
description: 'MANIFEST_BRANCH'
required: true
default: '12.1'
type: choice
options:
- 12.1
- 11.0
- 10.0
- 9.0
- 8.1
- 7.1
- 6.0
DEVICE_TREE:
description: 'Custom Recovery Tree'
default: '10.0'
DEVICE_TREE_URL:
description: 'DEVICE_TREE_URL'
required: true
default: 'https://github.com/lazycodebuilder/recovery_rmx1851'
default: 'https://github.com/momo54181/android_device_oppo_PACM00'
DEVICE_TREE_BRANCH:
description: 'Custom Recovery Tree Branch'
description: 'DEVICE_TREE_BRANCH'
required: true
default: 'android-14_ofrp'
BUILD_TARGET:
description: 'Specify your Build Target'
default: 'android-10'
DEVICE_PATH:
description: 'DEVICE_PATH'
required: true
default: 'recovery'
type: choice
options:
- boot
- recovery
- vendorboot
LDCHECK:
description: 'Use LDCHECK'
default: 'device/oppo/PACM00'
COMMON_TREE_URL:
description: 'COMMON_TREE_URL (if no common tree, leave blank)'
required: false
default: 'false'
type: boolean
LDCHECKPATH:
description: 'Path of blobs to check' # Use it know what kind of dependencies your missing for decryption blobs.
COMMON_PATH:
description: 'COMMON_PATH (if no common tree, leave blank)'
required: false
DEVICE_NAME:
description: 'DEVICE_NAME'
required: true
default: 'PACM00'
MAKEFILE_NAME:
description: 'MAKEFILE_NAME'
required: true
default: 'system/bin/qseecomd'
default: 'omni_PACM00'
BUILD_TARGET:
description: 'BUILD_TARGET'
required: true
default: 'recovery'

jobs:
build:
name: Build OFRP by ${{ github.actor }}
runs-on: ubuntu-20.04
if: github.event.repository.owner.id == github.event.sender.id
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Display Inputs
run: |
echo "Displaying variables/inputs."
echo "Manifest Branch: ${{ inputs.MANIFEST_BRANCH }}"
echo "Device Tree: ${{ inputs.DEVICE_TREE }}"
echo "Device Branch: ${{ inputs.DEVICE_TREE_BRANCH }}"
echo "Build Target: ${{ inputs.BUILD_TARGET }}image"
- name: Clean-up

# You might want to Checkout your repo first, but not mandatory
- name: Check Out
uses: actions/checkout@v3

# Cleanup The Actions Workspace Using Custom Composite Run Actions
- name: Cleanup
uses: rokibhasansagar/slimhub_actions@main

- name: Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 12

- name: Build Environment
- name: Initialize workspace
run: |
mkdir workspace
cd workspace
echo "workspace-folder=$(pwd)" >> $GITHUB_OUTPUT
id: pwd

- name: Prepare the build environment
run: |
sudo apt install aria2 -y
sudo apt install git aria2 -y
git clone https://gitlab.com/OrangeFox/misc/scripts
cd scripts
sudo bash setup/android_build_env.sh
<<<<<<< HEAD

- name: Set-up Manifest
run: |
Expand All @@ -99,109 +94,74 @@ jobs:
chmod 777 orangefox_sync.sh
./orangefox_sync.sh --branch ${{ inputs.MANIFEST_BRANCH }} --path ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}
fi
=======
sed -i 's/cd -/cd ../g' setup/install_android_sdk.sh
sudo bash setup/install_android_sdk.sh
working-directory: ${{ steps.pwd.outputs.workspace-folder }}
>>>>>>> parent of 8ccc3cb (Update OrangeFox [OFRP].yml)

- name: Clone Device Tree
- name: Sync OrangeFox sources and minimal manifest
run: |
cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}
git clone ${{ inputs.DEVICE_TREE }} -b ${{ inputs.DEVICE_TREE_BRANCH }} ./device_tree
cd device_tree
echo "COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV
cd ${{ steps.pwd.outputs.workspace-folder }}
git clone ${{ github.event.inputs.SYNC_URL }}
cd sync
chmod 777 orangefox_sync.sh
./orangefox_sync.sh --branch ${{ github.event.inputs.MANIFEST_BRANCH }} --path ${{ steps.pwd.outputs.workspace-folder }}/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
working-directory: ${{ steps.pwd.outputs.workspace-folder }}

- name: Extracting variables from .mk file
- name: Clone device tree
run: |
cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}/device_tree
# Initialize variables
DEVICE_MAKEFILE=""
DEVICE_DIRECTORY=""
DEVICE_NAME=""
# Loop through each .mk file in the current directory
for file in *.mk; do
# Extract variables using sed
makefile=$(sed -n 's/^[[:space:]]*PRODUCT_NAME[[:space:]]*:=\s*\(.*\)/\1/p' "$file")
brand=$(sed -n 's/^[[:space:]]*PRODUCT_BRAND[[:space:]]*:=\s*\(.*\)/\1/p' "$file")
codename=$(sed -n 's/^[[:space:]]*PRODUCT_DEVICE[[:space:]]*:=\s*\(.*\)/\1/p' "$file")
if [[ -n "$makefile" && -n "$brand" && -n "$codename" ]]; then
DEVICE_MAKEFILE="$makefile"
DEVICE_DIRECTORY="device/$brand"
DEVICE_NAME="$codename"
echo "DEVICE_MAKEFILE=${DEVICE_MAKEFILE}" >> $GITHUB_ENV
echo "DEVICE_NAME=${DEVICE_NAME}" >> $GITHUB_ENV
echo "DEVICE_DIRECTORY=${DEVICE_DIRECTORY}" >> $GITHUB_ENV
break
fi
done
# Navigate to the parent directory
cd ../
# Create the necessary directories
echo "Creating directory: $DEVICE_DIRECTORY"
mkdir -p "$DEVICE_DIRECTORY"
# Move device_tree folder to device_directory and rename it to $DEVICE_NAME
echo "Moving device_tree to $DEVICE_DIRECTORY/$DEVICE_NAME"
mv device_tree "$DEVICE_DIRECTORY"/"$DEVICE_NAME"
cd ${{ steps.pwd.outputs.workspace-folder }}/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
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: Installing python2 for legacy builds
if: env.CHECK_LEGACY_BRANCH == 'true'
- name: Clone common tree
if: |
github.event.inputs.COMMON_TREE_URL != null
&& github.event.inputs.COMMON_PATH != null
run: |
sudo apt-get install python2 python-is-python2
cd ${{ steps.pwd.outputs.workspace-folder }}/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
git clone ${{ github.event.inputs.COMMON_TREE_URL }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.COMMON_PATH }}
working-directory: ${{ steps.pwd.outputs.workspace-folder }}

- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 12

- name: install py-is-py2
run: sudo apt-get install python-is-python2

- name: Building OrangeFox
- name: Building recovery
run: |
cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}
cd ${{ steps.pwd.outputs.workspace-folder }}/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
set +e
source build/envsetup.sh
export FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER=1
export ALLOW_MISSING_DEPENDENCIES=true
set -e
if [ ${{ inputs.MANIFEST_BRANCH }} == '11.0' ] || [ ${{ inputs.MANIFEST_BRANCH }} == '12.1' ]; then
lunch twrp_${{ env.DEVICE_NAME }}-eng && make clean && mka adbd ${{ inputs.BUILD_TARGET }}image
else
lunch omni_${{ env.DEVICE_NAME }}-eng && make clean && mka ${{ inputs.BUILD_TARGET }}image
fi
- name: Set Build Date # For Build Date Info, currently using Asia/Manila
run: |
echo "BUILD_DATE=$(TZ=Asia/Manila date +%Y%m%d)" >> $GITHUB_ENV
lunch ${{ github.event.inputs.MAKEFILE_NAME }}-eng && make clean && mka adbd ${{ github.event.inputs.BUILD_TARGET }}image -j$(nproc --all)
working-directory: ${{ steps.pwd.outputs.workspace-folder }}
continue-on-error: true

- name: Check if Recovery Exist
- name: Check the output directory before uploading
run: |
cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}
if [ -f out/target/product/${{ env.DEVICE_NAME }}/OrangeFox*.img ]; then
echo "CHECK_IMG_IS_OK=true" >> $GITHUB_ENV
echo "MD5_IMG=$(md5sum out/target/product/${{ env.DEVICE_NAME }}/OrangeFox*.img | cut -d ' ' -f 1)" >> $GITHUB_ENV
else
echo "Recovery out directory is empty."
fi
if [ -f out/target/product/${{ env.DEVICE_NAME }}/OrangeFox*.zip ]; then
echo "CHECK_ZIP_IS_OK=true" >> $GITHUB_ENV
echo "MD5_ZIP=$(md5sum out/target/product/${{ env.DEVICE_NAME }}/OrangeFox*.zip | cut -d ' ' -f 1)" >> $GITHUB_ENV
else
echo "Recovery out directory is empty."
fi
ls -al ${{ steps.pwd.outputs.workspace-folder }}/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/
echo
ls -al ${{ steps.pwd.outputs.workspace-folder }}/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/
- name: Upload to Release
if: env.CHECK_IMG_IS_OK == 'true' && env.CHECK_ZIP_IS_OK == 'true'
uses: softprops/action-gh-release@master
uses: softprops/action-gh-release@v1
with:
files: |
OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ env.DEVICE_NAME }}/OrangeFox*.img
OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ env.DEVICE_NAME }}/OrangeFox*.img.tar
OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ env.DEVICE_NAME }}/OrangeFox*.zip
OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ env.DEVICE_NAME }}/ramdisk-recovery.*
name: Unofficial OrangeFox for ${{ env.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
${{ steps.pwd.outputs.workspace-folder }}/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/*.img
${{ steps.pwd.outputs.workspace-folder }}/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/*.zip
name: ${{ github.event.inputs.DEVICE_NAME }}-${{ github.run_id }}
tag_name: ${{ github.run_id }}
body: |
Build: ${{ inputs.MANIFEST_BRANCH }}
Device: [Device Tree/Branch](${{ inputs.DEVICE_TREE }}/tree/${{ inputs.DEVICE_TREE_BRANCH }})
Commit: Most recent [commit](${{ inputs.DEVICE_TREE }}/commit/${{ env.COMMIT_ID }}) during building.
MD5 (img): ${{ env.MD5_IMG }}
MD5 (zip): ${{ env.MD5_ZIP }}
- name: Run LDCheck
if: inputs.LDCHECK == 'true'
run: |
cd tools
mv -n libneeds ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ env.DEVICE_NAME }}/recovery/root/
mv -n ldcheck ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ env.DEVICE_NAME }}/recovery/root/
cd ../OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ env.DEVICE_NAME }}/recovery/root
python3 ldcheck -p system/lib64:vendor/lib64:system/lib:vendor/lib -d ${{ inputs.LDCHECKPATH }}
echo "Done checking missing dependencies. Review, and reconfigure your tree."
continue-on-error: true
Manifest: ${{ github.event.inputs.MANIFEST_BRANCH }}
Device: ${{ github.event.inputs.DEVICE_NAME }}
Target: ${{ github.event.inputs.BUILD_TARGET }}.img
TREE: [Device Tree/Branch](${{ github.event.inputs.DEVICE_TREE_URL }}/tree/${{ github.event.inputs.DEVICE_TREE_BRANCH }})
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 3601213

Please sign in to comment.