Skip to content

Commit

Permalink
Add OrangeFox support
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainThrowback committed Feb 11, 2024
1 parent 3fdc2e3 commit 5cbaad9
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 44 deletions.
128 changes: 84 additions & 44 deletions .github/workflows/Recovery Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ name: Recovery Build
on:
workflow_dispatch:
inputs:
CUSTOM_REPO:
type: choice
description: 'Choose the custom recovery you are building'
options:
- OrangeFox
- PBRP
- SHRP
- TWRP
required: true
default: 'TWRP'
MANIFEST_URL:
description: 'MANIFEST_URL (if using SSH keys, use [email protected]:repo URL format)'
required: true
Expand Down Expand Up @@ -45,13 +55,14 @@ jobs:
- 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 "Build Target: ${{ github.event.inputs.BUILD_TARGET }}.img"
echo "Custom Repo: ${{ inputs.CUSTOM_REPO }}"
echo "Manifest URL: ${{ inputs.MANIFEST_URL }}"
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
Expand All @@ -66,7 +77,7 @@ jobs:
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 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 aria2
sudo add-apt-repository universe
sudo apt -y install libncurses5
Expand All @@ -77,7 +88,7 @@ jobs:
java-version: '8'

- name: Setup SSH Keys
if: ${{ startsWith(github.event.inputs.MANIFEST_URL, '[email protected]') }}
if: ${{ startsWith(inputs.MANIFEST_URL, '[email protected]') }}
uses: webfactory/[email protected]
with:
ssh-private-key: |
Expand All @@ -90,17 +101,31 @@ jobs:
chmod a+x ~/bin/repo
sudo ln -sf ~/bin/repo /usr/bin/repo
- name: Initialize repo
- name: Create workspace
run: |
mkdir workspace
mkdir workspace_sync
cd workspace
echo "workspace-folder=$(pwd)" >> $GITHUB_OUTPUT
git config --global user.name "Captain Throwback"
git config --global user.email "[email protected]"
repo init --depth=1 -u ${{ github.event.inputs.MANIFEST_URL }} -b ${{ github.event.inputs.MANIFEST_BRANCH }}
id: pwd


- name: Initialize repo
if: ${{ inputs.CUSTOM_REPO != 'OrangeFox' }}
run: |
repo init --depth=1 -u ${{ inputs.MANIFEST_URL }} -b ${{ inputs.MANIFEST_BRANCH }}
- name: Initialize repo (OrangeFox)
if: ${{ inputs.CUSTOM_REPO == 'OrangeFox' }}
run: |
git clone ${{ inputs.MANIFEST_URL }}
cd sync
./orangefox_sync.sh --branch ${{ inputs.MANIFEST_BRANCH }} --path ${{ steps.pwd.outputs.workspace-folder }}
working-directory: workspace_sync

- name: Repo Sync
if: ${{ inputs.CUSTOM_REPO != 'OrangeFox' }}
run: |
repo sync -j$(nproc --all) --force-sync
working-directory: workspace
Expand All @@ -109,52 +134,56 @@ jobs:
uses: haya14busa/action-cond@v1
id: buildtree
with:
cond: ${{ github.event.inputs.MANIFEST_BRANCH == 'twrp-11' || github.event.inputs.MANIFEST_BRANCH == 'twrp-12.1' }}
cond: ${{ contains( inputs.MANIFEST_BRANCH,'11' ) || contains( inputs.MANIFEST_BRANCH,'12.1' ) }}
if_true: twrp
if_false: omni

- name: Create roomservice.xml
run: |
mkdir -p .repo/local_manifests
cp -f ${GITHUB_WORKSPACE}/templates/roomservice.xml .repo/local_manifests/
working-directory: ${{ steps.pwd.outputs.workspace-folder }}
cp -f ${GITHUB_WORKSPACE}/templates/* .repo/local_manifests/
working-directory: workspace

- name: Clone device tree (TeamWin)
if: |
contains( github.event.inputs.DEVICE_TREE_URL,'/TeamWin/' )
contains( inputs.DEVICE_TREE_URL,'/TeamWin/' )
&& steps.buildtree.outputs.value == 'twrp'
&& inputs.CUSTOM_REPO != 'OrangeFox'
run: |
sed -i "s%\!--project name=\"{DEVICE_TREE_URL_REPO}%project name=\"$(grep -oP '(?<=TeamWin/).*' <<< ${{ github.event.inputs.DEVICE_TREE_URL }})%g" .repo/local_manifests/roomservice.xml
sed -i "s%{DEVICE_PATH}%${{ github.event.inputs.DEVICE_PATH }}%g" .repo/local_manifests/roomservice.xml
sed -i "s%\!--project name=\"{DEVICE_TREE_URL_REPO}%project name=\"$(grep -oP '(?<=TeamWin/).*' <<< ${{ 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}%TeamWin%g" .repo/local_manifests/roomservice.xml
sed -i "s%{DEVICE_TREE_BRANCH}\"/-->%${{ github.event.inputs.DEVICE_TREE_BRANCH }}\"/>%g" .repo/local_manifests/roomservice.xml
sed -i "s%{DEVICE_TREE_BRANCH}\"/-->%${{ inputs.DEVICE_TREE_BRANCH }}\"/>%g" .repo/local_manifests/roomservice.xml
repo sync -j$(nproc --all)
working-directory: ${{ steps.pwd.outputs.workspace-folder }}
working-directory: workspace

- name: Clone device tree (Github)
if: |
!contains( github.event.inputs.DEVICE_TREE_URL,'/TeamWin/' )
!contains( inputs.DEVICE_TREE_URL,'/TeamWin/' )
&& steps.buildtree.outputs.value == 'twrp'
&& inputs.CUSTOM_REPO != 'OrangeFox'
run: |
sed -i "s%\!--project name=\"{DEVICE_TREE_URL_REPO}%project name=\"$(grep -oP '(?<=github.com/).*' <<< ${{ github.event.inputs.DEVICE_TREE_URL }})%g" .repo/local_manifests/roomservice.xml
sed -i "s%{DEVICE_PATH}%${{ github.event.inputs.DEVICE_PATH }}%g" .repo/local_manifests/roomservice.xml
sed -i "s%{DEVICE_REMOTE_NAME}%github%g" .repo/local_manifests/roomservice.xml
sed -i "s%{DEVICE_TREE_BRANCH}\"/-->%${{ github.event.inputs.DEVICE_TREE_BRANCH }}\"/>%g" .repo/local_manifests/roomservice.xml
sed -i "s%\!--project name=\"{DEVICE_TREE_URL_REPO}%project name=\"$(grep -oP '(?<=b.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}%$(grep -oP '(?<=//).*(?=.com)' <<< ${{ inputs.DEVICE_TREE_URL }})%g" .repo/local_manifests/roomservice.xml
sed -i "s%{DEVICE_TREE_BRANCH}\"/-->%${{ inputs.DEVICE_TREE_BRANCH }}\"/>%g" .repo/local_manifests/roomservice.xml
repo sync -j$(nproc --all)
working-directory: ${{ steps.pwd.outputs.workspace-folder }}
working-directory: workspace

- name: Clone device tree (Omni)
if: ${{ steps.buildtree.outputs.value == 'omni' }}
- name: Clone device tree (Omni/Other)
if: |
steps.buildtree.outputs.value == 'omni'
|| inputs.CUSTOM_REPO == 'OrangeFox'
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 }}
git clone ${{ inputs.DEVICE_TREE_URL }} -b ${{ inputs.DEVICE_TREE_BRANCH }} ./${{ inputs.DEVICE_PATH }}
working-directory: workspace

- name: Sync Device Dependencies (AOSP)
if: ${{ steps.buildtree.outputs.value == 'twrp' }}
run: |
source build/envsetup.sh
lunch ${{ steps.buildtree.outputs.value }}_${{ github.event.inputs.DEVICE_NAME }}-eng
working-directory: ${{ steps.pwd.outputs.workspace-folder }}
lunch ${{ steps.buildtree.outputs.value }}_${{ inputs.DEVICE_NAME }}-eng
working-directory: workspace
id: syncdevicedeps
continue-on-error: true

Expand All @@ -163,9 +192,9 @@ jobs:
steps.buildtree.outputs.value == 'omni'
|| steps.syncdevicedeps.outcome == 'failure'
run: |
bash ${GITHUB_WORKSPACE}/scripts/convert.sh ${{ github.event.inputs.DEVICE_PATH }}/${{ steps.buildtree.outputs.value }}.dependencies
bash ${GITHUB_WORKSPACE}/scripts/convert.sh ${{ inputs.DEVICE_PATH }}/${{ steps.buildtree.outputs.value }}.dependencies
repo sync -j$(nproc --all)
working-directory: ${{ steps.pwd.outputs.workspace-folder }}
working-directory: workspace
continue-on-error: true

- name: Set Swap Space
Expand All @@ -174,11 +203,11 @@ jobs:
swap-size-gb: 24

- name: Repopick Gerrit patches
if: github.event.inputs.REPOPICK_PATCHES != null
if: inputs.REPOPICK_PATCHES != null
run: |
source build/envsetup.sh
repopick ${{ github.event.inputs.REPOPICK_PATCHES }}
working-directory: ${{ steps.pwd.outputs.workspace-folder }}
repopick ${{ inputs.REPOPICK_PATCHES }}
working-directory: workspace
continue-on-error: true

- name: Install Python 2
Expand All @@ -189,21 +218,32 @@ jobs:
sudo ln -sf python2 python
- name: Building recovery
if: ${{ inputs.CUSTOM_REPO != 'OrangeFox' }}
run: |
source build/envsetup.sh
export ALLOW_MISSING_DEPENDENCIES=true
lunch ${{ steps.buildtree.outputs.value }}_${{ github.event.inputs.DEVICE_NAME }}-eng && make ${{ github.event.inputs.BUILD_TARGET }}image -j$(nproc --all)
working-directory: ${{ steps.pwd.outputs.workspace-folder }}
lunch ${{ steps.buildtree.outputs.value }}_${{ inputs.DEVICE_NAME }}-eng && make ${{ inputs.BUILD_TARGET }}image -j$(nproc --all)
working-directory: workspace

- name: Building recovery (OrangeFox)
if: ${{ inputs.CUSTOM_REPO == 'OrangeFox' }}
run: |
source build/envsetup.sh
export ALLOW_MISSING_DEPENDENCIES=true
export FOX_BUILD_DEVICE=${{ inputs.DEVICE_NAME }}
lunch ${{ steps.buildtree.outputs.value }}_${{ inputs.DEVICE_NAME }}-eng && make ${{ inputs.BUILD_TARGET }}image -j$(nproc --all)
working-directory: workspace

- name: Upload to Release
uses: softprops/action-gh-release@v1
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 }}
files: workspace/out/target/product/${{ inputs.DEVICE_NAME }}/${{ inputs.BUILD_TARGET }}.img
name: ${{ inputs.DEVICE_NAME }}-${{ github.run_id }}
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
Recovery: ${{ inputs.CUSTOM_REPO }}
Manifest: ${{ inputs.MANIFEST_BRANCH }}
Device: ${{ inputs.DEVICE_NAME }}
Target: ${{ inputs.BUILD_TARGET }}.img
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions templates/remotes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="gitlab"
fetch="https://gitlab.com"/>
</manifest>

0 comments on commit 5cbaad9

Please sign in to comment.