From c820160bf847ad7efede27f686e5c37aee8540fd Mon Sep 17 00:00:00 2001 From: Momo5418 Date: Tue, 1 Oct 2024 10:54:05 +0800 Subject: [PATCH 1/6] Update OrangeFox [OFRP].yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新上游,修复 error: Cannot checkout android_frameworks_base: ManifestInvalidRevisionError: revision android-10 in android_frameworks_base not found --- .github/workflows/OrangeFox [OFRP].yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/OrangeFox [OFRP].yml b/.github/workflows/OrangeFox [OFRP].yml index dc658e3..e4b27f0 100644 --- a/.github/workflows/OrangeFox [OFRP].yml +++ b/.github/workflows/OrangeFox [OFRP].yml @@ -6,23 +6,23 @@ on: SYNC_URL: description: 'SYNC_URL' required: true - default: 'https://github.com/byf3332/sync.git' + default: 'https://github.com/momo54181/ofrp-sync.git' MANIFEST_BRANCH: description: 'MANIFEST_BRANCH' required: true - default: '9.0' + default: '10.0' DEVICE_TREE_URL: description: 'DEVICE_TREE_URL' required: true - default: 'https://github.com/byf3332/Xiaomi-Archimedes-device-tree' + default: 'https://github.com/momo54181/android_device_oppo_PACM00' DEVICE_TREE_BRANCH: description: 'DEVICE_TREE_BRANCH' required: true - default: 'main' + default: 'android-10' DEVICE_PATH: description: 'DEVICE_PATH' required: true - default: 'device/xiaomi/Archimedes' + default: 'device/oppo/PACM00' COMMON_TREE_URL: description: 'COMMON_TREE_URL (if no common tree, leave blank)' required: false @@ -32,11 +32,11 @@ on: DEVICE_NAME: description: 'DEVICE_NAME' required: true - default: 'Archimedes' + default: 'PACM00' MAKEFILE_NAME: description: 'MAKEFILE_NAME' required: true - default: 'omni_Archimedes' + default: 'omni_PACM00' BUILD_TARGET: description: 'BUILD_TARGET' required: true From 8ccc3cbbbb4bcab4e8020714f3ba9919a682af80 Mon Sep 17 00:00:00 2001 From: Momo5418 Date: Tue, 1 Oct 2024 11:38:14 +0800 Subject: [PATCH 2/6] Update OrangeFox [OFRP].yml --- .github/workflows/OrangeFox [OFRP].yml | 254 +++++++++++++++---------- 1 file changed, 158 insertions(+), 96 deletions(-) diff --git a/.github/workflows/OrangeFox [OFRP].yml b/.github/workflows/OrangeFox [OFRP].yml index e4b27f0..b4b844c 100644 --- a/.github/workflows/OrangeFox [OFRP].yml +++ b/.github/workflows/OrangeFox [OFRP].yml @@ -3,141 +3,203 @@ 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: 'MANIFEST_BRANCH' + description: 'OrangeFox Manifest Branch' required: true - default: '10.0' - DEVICE_TREE_URL: - description: 'DEVICE_TREE_URL' + 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' required: true - default: 'https://github.com/momo54181/android_device_oppo_PACM00' + default: 'https://github.com/lazycodebuilder/recovery_rmx1851' DEVICE_TREE_BRANCH: - description: 'DEVICE_TREE_BRANCH' - required: true - default: 'android-10' - DEVICE_PATH: - description: 'DEVICE_PATH' + description: 'Custom Recovery Tree Branch' required: true - default: 'device/oppo/PACM00' - COMMON_TREE_URL: - description: 'COMMON_TREE_URL (if no common tree, leave blank)' - required: false - 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: 'omni_PACM00' + default: 'android-14_ofrp' BUILD_TARGET: - description: 'BUILD_TARGET' + description: 'Specify your Build Target' required: true default: 'recovery' + type: choice + options: + - boot + - recovery + - vendorboot + LDCHECK: + description: 'Use LDCHECK' + 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. + required: true + default: 'system/bin/qseecomd' jobs: build: - if: github.event.repository.owner.id == github.event.sender.id + 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 }} permissions: contents: write steps: + - name: Checkout + uses: actions/checkout@v4 - - # 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: Initialize workspace + - name: Display Inputs run: | - mkdir workspace - cd workspace - echo "workspace-folder=$(pwd)" >> $GITHUB_OUTPUT - id: pwd + 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 + uses: rokibhasansagar/slimhub_actions@main - - name: Prepare the build environment + - name: Swap Space + uses: pierotofy/set-swap-space@master + with: + swap-size-gb: 12 + + - name: Build Environment run: | - sudo apt install git aria2 -y + sudo apt install aria2 -y git clone https://gitlab.com/OrangeFox/misc/scripts cd scripts sudo bash setup/android_build_env.sh - 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 }} - - - name: Sync OrangeFox sources and minimal manifest + + - name: Set-up Manifest run: | - 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 }} + mkdir -p ${GITHUB_WORKSPACE}/OrangeFox + cd ${GITHUB_WORKSPACE}/OrangeFox + git config --global user.name "lazycodebuilder" + git config --global user.email "154446636+lazycodebuilder@users.noreply.github.com" + git clone https://github.com/momo54181/ofrp-sync.git + if [ ${{ inputs.MANIFEST_BRANCH }} == '11.0' ] || [ ${{ inputs.MANIFEST_BRANCH }} == '12.1' ]; then + echo "Sync fox_${{ inputs.MANIFEST_BRANCH }} branch" + echo "CHECK_LEGACY_BRANCH=false" >> $GITHUB_ENV + cd sync + ./orangefox_sync.sh --branch ${{ inputs.MANIFEST_BRANCH }} --path ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }} + else + echo "Sync legacy fox_${{ inputs.MANIFEST_BRANCH }} branch" + echo "CHECK_LEGACY_BRANCH=true" >> $GITHUB_ENV + cd sync + ./orangefox_sync.sh --branch ${{ inputs.MANIFEST_BRANCH }} --path ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }} + fi - - name: Clone device tree + - name: Clone Device Tree run: | - 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 }} + 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 - - name: Clone common tree - if: | - github.event.inputs.COMMON_TREE_URL != null - && github.event.inputs.COMMON_PATH != null + - name: Extracting variables from .mk file run: | - 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 }} + 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" - - 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: Installing python2 for legacy builds + if: env.CHECK_LEGACY_BRANCH == 'true' + run: | + sudo apt-get install python2 python-is-python2 - - name: Building recovery + - name: Building OrangeFox run: | - cd ${{ steps.pwd.outputs.workspace-folder }}/fox_${{ github.event.inputs.MANIFEST_BRANCH }} + cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }} set +e source build/envsetup.sh - export FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER=1 export ALLOW_MISSING_DEPENDENCIES=true set -e - 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 + 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 - - name: Check the output directory before uploading + - name: Check if Recovery Exist run: | - 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 }}/ + 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 - name: Upload to Release - uses: softprops/action-gh-release@v1 + if: env.CHECK_IMG_IS_OK == 'true' && env.CHECK_ZIP_IS_OK == 'true' + uses: softprops/action-gh-release@master with: files: | - ${{ 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 }} + 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 }} 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 - TREE: [Device Tree/Branch](${{ github.event.inputs.DEVICE_TREE_URL }}/tree/${{ github.event.inputs.DEVICE_TREE_BRANCH }}) - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + 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 From 8a623e597f35dcd39dda6d5c0bdbbab94fda43ac Mon Sep 17 00:00:00 2001 From: Momo5418 Date: Tue, 1 Oct 2024 11:41:30 +0800 Subject: [PATCH 3/6] Update OrangeFox [OFRP].yml --- .github/workflows/OrangeFox [OFRP].yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/OrangeFox [OFRP].yml b/.github/workflows/OrangeFox [OFRP].yml index b4b844c..c4b7ba5 100644 --- a/.github/workflows/OrangeFox [OFRP].yml +++ b/.github/workflows/OrangeFox [OFRP].yml @@ -89,12 +89,12 @@ jobs: if [ ${{ inputs.MANIFEST_BRANCH }} == '11.0' ] || [ ${{ inputs.MANIFEST_BRANCH }} == '12.1' ]; then echo "Sync fox_${{ inputs.MANIFEST_BRANCH }} branch" echo "CHECK_LEGACY_BRANCH=false" >> $GITHUB_ENV - cd sync + cd ofrp-sync ./orangefox_sync.sh --branch ${{ inputs.MANIFEST_BRANCH }} --path ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }} else echo "Sync legacy fox_${{ inputs.MANIFEST_BRANCH }} branch" echo "CHECK_LEGACY_BRANCH=true" >> $GITHUB_ENV - cd sync + cd ofrp-sync ./orangefox_sync.sh --branch ${{ inputs.MANIFEST_BRANCH }} --path ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }} fi From 1def3fae73c9ac5db5b8465a63d8ab1433566578 Mon Sep 17 00:00:00 2001 From: Momo5418 Date: Tue, 1 Oct 2024 11:54:12 +0800 Subject: [PATCH 4/6] Update OrangeFox [OFRP].yml --- .github/workflows/OrangeFox [OFRP].yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/OrangeFox [OFRP].yml b/.github/workflows/OrangeFox [OFRP].yml index c4b7ba5..1bea18e 100644 --- a/.github/workflows/OrangeFox [OFRP].yml +++ b/.github/workflows/OrangeFox [OFRP].yml @@ -90,11 +90,13 @@ jobs: echo "Sync fox_${{ inputs.MANIFEST_BRANCH }} branch" echo "CHECK_LEGACY_BRANCH=false" >> $GITHUB_ENV cd ofrp-sync + chmod 777 orangefox_sync.sh ./orangefox_sync.sh --branch ${{ inputs.MANIFEST_BRANCH }} --path ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }} else echo "Sync legacy fox_${{ inputs.MANIFEST_BRANCH }} branch" echo "CHECK_LEGACY_BRANCH=true" >> $GITHUB_ENV cd ofrp-sync + chmod 777 orangefox_sync.sh ./orangefox_sync.sh --branch ${{ inputs.MANIFEST_BRANCH }} --path ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }} fi From 360121396f838c71e8b04cc691baff5d0b1278db Mon Sep 17 00:00:00 2001 From: Momo5418 Date: Tue, 1 Oct 2024 12:06:36 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20OrangeFox=20[OFRP].yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/OrangeFox [OFRP].yml | 238 ++++++++++--------------- 1 file changed, 99 insertions(+), 139 deletions(-) diff --git a/.github/workflows/OrangeFox [OFRP].yml b/.github/workflows/OrangeFox [OFRP].yml index 1bea18e..020f337 100644 --- a/.github/workflows/OrangeFox [OFRP].yml +++ b/.github/workflows/OrangeFox [OFRP].yml @@ -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: | @@ -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 }} From b29428a780d92af67aeb46e5522119966ea06824 Mon Sep 17 00:00:00 2001 From: Momo5418 Date: Tue, 1 Oct 2024 12:08:32 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20OrangeFox=20[OFRP].yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/OrangeFox [OFRP].yml | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/.github/workflows/OrangeFox [OFRP].yml b/.github/workflows/OrangeFox [OFRP].yml index 020f337..a288530 100644 --- a/.github/workflows/OrangeFox [OFRP].yml +++ b/.github/workflows/OrangeFox [OFRP].yml @@ -72,39 +72,15 @@ jobs: git clone https://gitlab.com/OrangeFox/misc/scripts cd scripts sudo bash setup/android_build_env.sh -<<<<<<< HEAD - - - name: Set-up Manifest - run: | - mkdir -p ${GITHUB_WORKSPACE}/OrangeFox - cd ${GITHUB_WORKSPACE}/OrangeFox - git config --global user.name "lazycodebuilder" - git config --global user.email "154446636+lazycodebuilder@users.noreply.github.com" - git clone https://github.com/momo54181/ofrp-sync.git - if [ ${{ inputs.MANIFEST_BRANCH }} == '11.0' ] || [ ${{ inputs.MANIFEST_BRANCH }} == '12.1' ]; then - echo "Sync fox_${{ inputs.MANIFEST_BRANCH }} branch" - echo "CHECK_LEGACY_BRANCH=false" >> $GITHUB_ENV - cd ofrp-sync - chmod 777 orangefox_sync.sh - ./orangefox_sync.sh --branch ${{ inputs.MANIFEST_BRANCH }} --path ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }} - else - echo "Sync legacy fox_${{ inputs.MANIFEST_BRANCH }} branch" - echo "CHECK_LEGACY_BRANCH=true" >> $GITHUB_ENV - cd ofrp-sync - 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: Sync OrangeFox sources and minimal manifest run: | cd ${{ steps.pwd.outputs.workspace-folder }} git clone ${{ github.event.inputs.SYNC_URL }} - cd sync + cd ofrp-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 }}