Skip to content

Build TWRPs

Build TWRPs #7

Workflow file for this run

name: Build TWRPs
on:
push:
paths:
- ".github/workflows/twrp.yml"
workflow_dispatch:
schedule:
- cron: "14 13 * * 5"
jobs:
Read-configuration:
name: ®️ Parse *.config.json
runs-on: ubuntu-latest
outputs:
CONFIGS: ${{ steps.generate-matrix.outputs.CONFIGS }}
BUILD_DATE: ${{ steps.generate-builddate.outputs.BUILDDATE }}
steps:
# This action checks-out your CONFIGSitory under $GITHUB_WORKSPACE, so your workflow can access it.
- name: 🔴 Checkout
uses: actions/checkout@v4
# Match the configuration files in the CONFIGS directory, read the contents and merge them into an array.
- name: 🟠 Generate Matrix
id: generate-matrix
run: |
echo "CONFIGS<<EOF" >> $GITHUB_OUTPUT
jq -s '[.[][]]' TWRP/configs/*.config.json >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# Set compile time.
- name: 🟡 Set builddate
id: generate-builddate
run: echo "BUILDDATE=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
Build-TWRP:
name: ©️ Build TWRP
runs-on: ubuntu-latest
needs:
- Read-configuration
strategy:
max-parallel: 4
fail-fast: false
matrix:
CONFIG: ${{ fromJSON(needs.Read-configuration.outputs.CONFIGS) }}
env:
# Basic configuration
WORKSPACE: ${{ github.workspace }}
BUILD_DATE: ${{ needs.Read-configuration.outputs.BUILD_DATE }}
# OrangeFox sync scripts configuration
OF_LOCATION: ${{ github.workspace }}/OrangeFox
OF_SYNC_REPO: ${{ matrix.CONFIG.OrangeFox.Repo }}
OF_SYNC_BRANCH: ${{ matrix.CONFIG.OrangeFox.Branch }}
# DeviceTree configuration
DEVICE_REPO: ${{ matrix.CONFIG.Device.Repo }}
DEVICE_BRANCH: ${{ matrix.CONFIG.Device.Branch }}
DEVICE_LOCATION: ${{ matrix.CONFIG.Device.Location }}
DEVICE_NAME: ${{ matrix.CONFIG.Device.DeviceName }}
DEVICE_MAKEFILE: ${{ matrix.CONFIG.Device.Makefile }}
DEVICE_BOOT_PARTITION: ${{ matrix.CONFIG.Device.BootPartition }}
# Set output & ccache directory
OUT_DIR: "${{ github.workspace }}/out"
CCACHE_DIR: "${{ github.workspace }}/ccache"
steps:
# Clean up the workspace and make room for compilation
- name: ♈ Cleanup
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 512
swap-size-mb: 12288
remove-dotnet: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
- name: ♉ Prepare the build environment
run: |
cd ~
sudo apt update -y
sudo apt install git 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
- name: ♊ Sync OrangeFox sources and minimal manifest
run: |
git clone ${{ env.OF_SYNC_REPO }} sync
cd sync
./orangefox_sync.sh --branch ${{ env.OF_SYNC_BRANCH }} --path ${{ env.OF_LOCATION }}
- name: ♋ Place device trees and kernel
working-directory: ${{ env.OF_LOCATION }}
run: |
git clone --recursive --depth=1 -j $(nproc) --branch ${{ env.DEVICE_BRANCH }} ${{ env.DEVICE_REPO }} ${{ env.DEVICE_LOCATION }}
- name: ♍ Build it
working-directory: ${{ env.OF_LOCATION }}
continue-on-error: true
run: |
set +e
source build/envsetup.sh
export ALLOW_MISSING_DEPENDENCIES=true
set -e
lunch ${{ env.DEVICE_MAKEFILE }}-eng && mka adbd ${{ env.DEVICE_BOOT_PARTITION }}image
- name: ♎ Take the OrangeFox build
uses: actions/upload-artifact@v3
with:
name: OrangeFox
if-no-files-found: warn
path: |
${{ env.OUT_DIR }}/target/product/${{ env.DEVICE_NAME }}/*${{ env.DEVICE_NAME }}.img
${{ env.OUT_DIR }}/target/product/${{ env.DEVICE_NAME }}/*${{ env.DEVICE_NAME }}.zip
- name: ♏ Create GitHub Release => (${{ env.BUILD_DATE }})
continue-on-error: true
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.BUILD_DATE }}.${{ github.run_number }}
files: |
${{ env.OUT_DIR }}/target/product/${{ env.DEVICE_NAME }}/*${{ env.DEVICE_NAME }}.img
${{ env.OUT_DIR }}/target/product/${{ env.DEVICE_NAME }}/*${{ env.DEVICE_NAME }}.zip
generate_release_notes: true