Skip to content

Commit

Permalink
Add option to include recovery installer
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainThrowback committed Feb 16, 2024
1 parent 8a7af39 commit 28434c1
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 9 deletions.
49 changes: 45 additions & 4 deletions .github/workflows/Recovery Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ on:
required: true
default: 'device/asus/I003D'
DEVICE_NAME:
description: 'Device Name from tree (should match name on vendor_device.mk)'
description: 'Device Name from tree (should match name on twrp_<DEVICE_NAME>.mk)'
required: true
default: 'I003D'
REPOPICK_PATCHES:
description: 'Gerrit commit numbers separated by a space to be included in the build'
description: '(Optional) Gerrit commit numbers separated by a space to be included in the build (leave blank if not using)'
type: string
required: false
BUILD_TARGET:
Expand All @@ -44,6 +44,11 @@ on:
- vendor_boot
required: true
default: 'recovery'
RECOVERY_INSTALLER:
description: 'Include recovery installer zip'
type: boolean
required: true
default: false

jobs:
build:
Expand All @@ -60,6 +65,7 @@ jobs:
echo "Device Path: ${{ inputs.DEVICE_PATH }}"
echo "Device Name: ${{ inputs.DEVICE_NAME }}"
echo "Build Target: ${{ inputs.BUILD_TARGET }}.img"
echo "Include Recovery Installer: ${{ inputs.RECOVERY_INSTALLER }}"
echo "::endgroup::"
# You might want to Checkout your repo first, but not mandatory
Expand Down Expand Up @@ -120,7 +126,7 @@ jobs:
- name: Create roomservice.xml
run: |
mkdir -p .repo/local_manifests
cp -f ${GITHUB_WORKSPACE}/templates/roomservice.xml .repo/local_manifests/
cp -f ${GITHUB_WORKSPACE}/templates/*.xml .repo/local_manifests/
working-directory: workspace

- name: Clone device tree (TeamWin)
Expand Down Expand Up @@ -176,8 +182,34 @@ jobs:
if: inputs.REPOPICK_PATCHES != null
run: |
source build/envsetup.sh
repopick ${{ inputs.REPOPICK_PATCHES }}
repopick -g https://gerrit.twrp.me ${{ inputs.REPOPICK_PATCHES }}
working-directory: workspace
continue-on-error: true

- name: Include Recovery Installer
if: inputs.RECOVERY_INSTALLER == true && inputs.MANIFEST_BRANCH != '6.0' && inputs.BUILD_TARGET != 'vendor_boot'
run: |
case ${{ inputs.MANIFEST_BRANCH }} in
7.1)
patchNum=5080
;;
8.1)
patchNum=5079
;;
9.0)
patchNum=5037
;;
11)
patchNum=4964
;;
12.1)
patchNum=5445
;;
esac
source build/envsetup.sh
repopick -g https://gerrit.twrp.me ${patchNum}
working-directory: workspace
id: recoveryinstaller
continue-on-error: true

- name: Install Python 2
Expand All @@ -192,6 +224,10 @@ jobs:
run: |
source build/envsetup.sh
export ALLOW_MISSING_DEPENDENCIES=true
if [ ${{ inputs.RECOVERY_INSTALLER }} = true ] && [ ${{ steps.recoveryinstaller.outcome == 'success' }} ]; then
export USE_RECOVERY_INSTALLER=true
export RECOVERY_INSTALLER_PATH=bootable/recovery/installer
fi
lunch twrp_${{ inputs.DEVICE_NAME }}-eng && make $(tr -d _ <<< ${{ inputs.BUILD_TARGET }})image -j$(nproc --all)
working-directory: workspace

Expand All @@ -200,6 +236,10 @@ jobs:
run: |
source build/envsetup.sh
export ALLOW_MISSING_DEPENDENCIES=true
if [ ${{ inputs.RECOVERY_INSTALLER }} = true ] && [ ${{ steps.recoveryinstaller.outcome == 'success' }} ]; then
export USE_RECOVERY_INSTALLER=true
export RECOVERY_INSTALLER_PATH=bootable/recovery/installer
fi
lunch ${{ steps.buildtree.outputs.value }}_${{ inputs.DEVICE_NAME }}-eng && make ${{ inputs.BUILD_TARGET }}image -j$(nproc --all)
working-directory: workspace

Expand All @@ -208,6 +248,7 @@ jobs:
with:
files: |
workspace/out/target/product/${{ inputs.DEVICE_NAME }}/${{ inputs.BUILD_TARGET }}.img
workspace/out/target/product/${{ inputs.DEVICE_NAME }}/*installer*zip
workspace/out/target/product/${{ inputs.DEVICE_NAME }}/obj/PACKAGING/vendor_ramdisk_fragments_intermediates/recovery.*
workspace/out/target/product/${{ inputs.DEVICE_NAME }}/ramdisk-recovery.*
name: ${{ inputs.DEVICE_NAME }} (TWRP)
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ Support TWRP compilation and production

## Release Notes
```
= 2024-02-16
- Clarify options in README
= 2024-02-15
- Add option to include recovery installer
= 2024-02-12
- Split custom builds into separate branches (TWRP is default, others are WIP)
- Simplify manifest branch selection and remove URL input
Expand Down Expand Up @@ -62,11 +68,11 @@ Support TWRP compilation and production
| Name | Description | Example |
| ------------ | -------------------- | ------------ |
| `MANIFEST_BRANCH` | Source branch | 12.1 |
| `DEVICE_TREE_URL` | Device address | https://github.com/TeamWin/android_device_asus_I003D |
| `DEVICE_TREE_BRANCH` | Device branch | android-12.1 |
| `DEVICE_PATH` | Device location | device/asus/I003D |
| `DEVICE_NAME` | Model name | I003D |
| `REPOPICK_PATCHES` | Gerrit patches to include in build (space separated) | 1245 1437 |
| `DEVICE_TREE_URL` | Device tree address | https://github.com/TeamWin/android_device_asus_I003D |
| `DEVICE_TREE_BRANCH` | Device branch that you want to use for build (typically corresponds to the manifest branch) | android-12.1 |
| `DEVICE_PATH` | Device tree location for syncing, relative to workspace root (usually listed as "LOCAL_PATH" or "DEVICE_PATH" in BoardConfig.mk) | device/asus/I003D |
| `DEVICE_NAME` | Model name (same as twrp_<DEVICE_NAME>.mk from device tree | I003D |
| `REPOPICK_PATCHES` | (Optional) Gerrit patches to include in build (space separated) - if you don't know what this means, then leave blank | 1245 1437 |
| `BUILD_TARGET` | Build Target Partition (boot/recovery/vendor_boot) | recovery |

-----
Expand Down
4 changes: 4 additions & 0 deletions templates/installer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="osm0sis/twrp_abtemplate" path="bootable/recovery/installer" remote="github" revision="master" />
</manifest>

0 comments on commit 28434c1

Please sign in to comment.