Action-TWRP-Builder/.github/workflows/Recovery Build.yml
Captain Throwback 89bd7c6044
Update repo for twrp-5.1 to twrp-12.1 tree support
- Update defaults for 12.1 branch
- Add support for custom build target
- Add support for SSH keys
- Customize OpenJDK install
- Add more build info to release page
- Add support for common trees
- Display user variables at beginning of build
- Update README for all relevant changes
2022-07-07 14:53:35 -04:00

195 lines
6.8 KiB
YAML

name: Recovery Build
on:
workflow_dispatch:
inputs:
MANIFEST_URL:
description: 'MANIFEST_URL (if not using SSH keys, use https:// URL)'
required: true
default: 'git@github.com:minimal-manifest-twrp/platform_manifest_twrp_aosp.git'
MANIFEST_BRANCH:
description: 'MANIFEST_BRANCH'
required: true
default: 'twrp-12.1'
DEVICE_TREE_URL:
description: 'DEVICE_TREE_URL'
required: true
default: 'https://github.com/TeamWin/android_device_asus_I003D'
DEVICE_TREE_BRANCH:
description: 'DEVICE_TREE_BRANCH'
required: true
default: 'android-12.1'
DEVICE_PATH:
description: 'DEVICE_PATH'
required: true
default: 'device/asus/I003D'
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: 'I003D'
MAKEFILE_NAME:
description: 'MAKEFILE_NAME'
required: true
default: 'twrp_I003D'
BUILD_TARGET:
description: 'BUILD_TARGET'
required: true
default: 'recovery'
jobs:
build:
if: github.event.repository.owner.id == github.event.sender.id
runs-on: ubuntu-18.04
# You can use either of the ubuntu-18.04 or ubuntu-20.04 runner
steps:
- 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 Name: ${{ github.event.inputs.DEVICE_NAME }}"
echo "Build Target: ${{ github.event.inputs.BUILD_TARGET }}.img"
echo "::endgroup::"
# 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
# That's it! Now use your normal steps
- name: Prepare the environment
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-dev libxml2 lzop pngcrush schedtool squashfs-tools imagemagick libbz2-dev lzma ncftp python qemu-user-static libstdc++-10-dev
sudo apt-get update
sudo apt-get -y install --reinstall build-essential
- name: Install OpenJDK 7
if: |
github.event.inputs.MANIFEST_BRANCH == 'twrp-5.1'
|| github.event.inputs.MANIFEST_BRANCH == 'twrp-6.0'
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '7'
- name: Install OpenJDK 8
if: |
github.event.inputs.MANIFEST_BRANCH != 'twrp-5.1'
&& github.event.inputs.MANIFEST_BRANCH != 'twrp-6.0'
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'
- name: Verify Java Install
run: java -version
- name: Setup SSH Keys
if: ${{ startsWith(github.event.inputs.MANIFEST_URL, 'git@github.com') }}
uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: |
${{ secrets.SSH_PRIVATE_KEY }}
- name: Set variables
run: |
echo "::set-output name=date::$(date +%F)"
id: var
- name: Install repo
run: |
mkdir ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
export PATH=~/bin:$PATH
- name: Initialize repo
run: |
PATH=~/bin:$PATH
mkdir workspace
cd workspace
echo "::set-output name=pwd::$(pwd)"
git config --global user.name "Captain Throwback"
git config --global user.email "captainthrowback@hotmail.com"
repo init --depth=1 -u ${{ github.event.inputs.MANIFEST_URL }} -b ${{ github.event.inputs.MANIFEST_BRANCH }}
id: pwd
- name: Repo Sync
run: |
PATH=~/bin:$PATH
cd workspace
repo sync -j$(nproc --all) -f --force-sync
ls -al
- name: Clone device tree
run: |
PATH=~/bin:$PATH
cd ${{ steps.pwd.outputs.pwd }}
git clone ${{ github.event.inputs.DEVICE_TREE_URL }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.DEVICE_PATH }}
- name: Clone common tree
if: |
github.event.inputs.COMMON_TREE_URL != null
&& github.event.inputs.COMMON_PATH != null
run: |
PATH=~/bin:$PATH
cd ${{ steps.pwd.outputs.pwd }}
git clone ${{ github.event.inputs.COMMON_TREE_URL }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.COMMON_PATH }}
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 12
- name: Check Build Branch - Step 1
if: ${{ github.event.inputs.MANIFEST_BRANCH == 'twrp-12.1' }}
run: |
PATH=~/bin:$PATH
cd ${{ steps.pwd.outputs.pwd }}
source build/envsetup.sh
repopick 5405 5540
- name: Check Build Branch - Step 2
if: ${{ github.event.inputs.MANIFEST_BRANCH == 'twrp-5.1' }}
run: |
PATH=~/bin:$PATH
cd ${{ steps.pwd.outputs.pwd }}
cd bootable/recovery
git fetch https://gerrit.twrp.me/android_bootable_recovery refs/changes/29/5729/1 && git cherry-pick FETCH_HEAD
- name: Building recovery
run: |
PATH=~/bin:$PATH
cd ${{ steps.pwd.outputs.pwd }}
source build/envsetup.sh
lunch ${{ github.event.inputs.MAKEFILE_NAME }}-eng
export ALLOW_MISSING_DEPENDENCIES=true
make clean
make ${{ github.event.inputs.BUILD_TARGET }}image -j$(nproc --all)
- 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 }}
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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}