
Add script to convert dependencies file. Thanks to @Yilliee for providing the script! If dependency file doesn't exist, then report error and continue to next step (continue-on-error) Use conditional based on branch to identify expected name of dependency file Additional updates and cleanup, including: - Remove branch check for 5.1 (upstream merged) - Replace "cd" commands with working-directory - Remove PATH references - Symlink ~/bin/repo to /usr/bin so automatically included in PATH - Clean up repo command (-f is deprecated) - Only build JDK 8 (JDK 7 not needed) and remove version check - Display more build parameters (user environment variables)
177 lines
6.6 KiB
YAML
177 lines
6.6 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 Path: ${{ github.event.inputs.DEVICE_PATH }}"
|
|
echo "Device Name: ${{ github.event.inputs.DEVICE_NAME }}"
|
|
echo "Makefile Name: ${{ github.event.inputs.MAKEFILE_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 qemu-user-static libstdc++-10-dev python
|
|
|
|
- name: Install OpenJDK
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
distribution: 'zulu'
|
|
java-version: '8'
|
|
|
|
- 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
|
|
sudo ln -sf ~/bin/repo /usr/bin/repo
|
|
|
|
- name: Initialize repo
|
|
run: |
|
|
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: |
|
|
repo sync -j$(nproc --all) --force-sync
|
|
working-directory: workspace
|
|
|
|
- name: Clone device tree
|
|
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.pwd }}
|
|
|
|
- name: Clone common tree
|
|
if: |
|
|
github.event.inputs.COMMON_TREE_URL != null
|
|
&& github.event.inputs.COMMON_PATH != null
|
|
run: |
|
|
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.pwd }}
|
|
|
|
- name: Check Build Tree
|
|
uses: haya14busa/action-cond@v1
|
|
id: buildtree
|
|
with:
|
|
cond: ${{ github.event.inputs.MANIFEST_BRANCH == 'twrp-11' || github.event.inputs.MANIFEST_BRANCH == 'twrp-12.1' }}
|
|
if_true: twrp
|
|
if_false: omni
|
|
|
|
- name: Sync Device Dependencies
|
|
run: |
|
|
bash ${GITHUB_WORKSPACE}/scripts/convert.sh ${{ github.event.inputs.DEVICE_PATH }}/${{ steps.buildtree.outputs.value }}.dependencies
|
|
repo sync -j$(nproc --all)
|
|
working-directory: ${{ steps.pwd.outputs.pwd }}
|
|
continue-on-error: true
|
|
|
|
- name: Set Swap Space
|
|
uses: pierotofy/set-swap-space@master
|
|
with:
|
|
swap-size-gb: 12
|
|
|
|
- name: Check Build Branch
|
|
if: ${{ github.event.inputs.MANIFEST_BRANCH == 'twrp-12.1' }}
|
|
run: |
|
|
source build/envsetup.sh
|
|
repopick 5405 5540
|
|
working-directory: ${{ steps.pwd.outputs.pwd }}
|
|
|
|
- name: Building recovery
|
|
run: |
|
|
source build/envsetup.sh
|
|
export ALLOW_MISSING_DEPENDENCIES=true
|
|
lunch ${{ github.event.inputs.MAKEFILE_NAME }}-eng && make clean && make ${{ github.event.inputs.BUILD_TARGET }}image -j$(nproc --all)
|
|
working-directory: ${{ steps.pwd.outputs.pwd }}
|
|
|
|
- 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 }}
|