# adeveloper79/action-recovery-builder architecture

> Architecture diagram of the GitHub repository adeveloper79/action-recovery-builder, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adeveloper79/action-recovery-builder
- Repository: https://github.com/adeveloper79/action-recovery-builder

## Overview

##### Project Type & Purpose
- This repo is a GitHub Actions–powered build automation tool that compiles custom Android recoveries (TWRP, OrangeFox, PBRP, SHRP).
- It’s not a web app or microservice; it’s a CI/CD pipeline definition plus helper scripts and templates.

##### Top-Level Components
a. GitHub Events & Triggers
- User forks the repo or clicks “Run workflow” on the “Recovery Build” Action.
- A push or manual dispatch event triggers the `.github/workflows/Recovery Build.yml` workflow.
b. GitHub Actions Runner
- Hosted runner (Ubuntu VM) that executes the workflow steps.
c. Workflow Definition (`.github/workflows/Recovery Build.yml`)
- Defines jobs, build matrix (branches for TWRP/OrangeFox/PBRP/SHRP), environment variables (the parameters from README), and step ordering.
d. Helper Script (`scripts/convert.sh`)
- Handles building logic, parameter parsing, environment setup, conversion of build artifacts.
e. XML Templates (`templates/installer.xml`, `templates/roomservice.xml`)
- Provide optional installer and RoomService packaging instructions injected into the build.
f. External Services & Repositories
- AOSP manifests: minimal-manifest-twrp, OrangeFox sync, PitchBlack, SHRP manifest repos
- Gerrit (for `REPOPICK_PATCHES`)
- GitHub Releases (artifact storage endpoint)
g. Outputs / Artifacts
- Compiled recovery `.img` and optional installer ZIP uploaded to the GitHub Releases page for download.

##### Relationships & Data Flow
- Trigger → Runner → Checkout repo → Set up Android build environment →
- Fetch manifest & device tree (from user-specified URLs/branches) →
- Apply optional Gerrit patches →
- Execute `convert.sh` to compile recovery + package with XML templates →
- Upload artifacts to Releases.

##### Architectural Patterns & Principles
- Event-driven CI pipeline: each workflow run is an isolated, stateless job.
- Parameterization: environment variables drive multi-branch, multi-flavor builds.
- Reuse of templates/scripts: separation of concerns—YAML for orchestration, shell script for build logic, XML for packaging metadata.

##### Relevant Technologies & Frameworks
- GitHub Actions (YAML-based workflows, hosted Ubuntu runners)
- Bash scripting (`scripts/convert.sh`)
- Android build system (AOSP, device trees, manifests)
- XML templating for RoomService & installer packaging
- Git/Gerrit for source control and patch management

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Nodes
    Event["GitHub Event<br/>(push/manual)"]:::orchestration
    Workflow["Workflow Definition<br/>(Recovery Build.yml)"]:::orchestration
    Runner["Actions Runner<br/>(Ubuntu VM)"]:::orchestration
    Checkout["Checkout Repo"]:::orchestration
    Setup["Setup Android Build Env"]:::orchestration
    Fetch["Fetch Sources<br/>(AOSP manifests & device tree)"]:::external
    Patches["Apply Gerrit Patches"]:::external
    BuildScript["Convert Script<br/>(convert.sh)"]:::scripts
    subgraph "XML Templates"
        Installer["installer.xml"]:::scripts
        RoomService["roomservice.xml"]:::scripts
    end
    Package["Package Recovery + Templates"]:::scripts
    Upload["Upload Artifacts<br/>(GitHub Releases)"]:::outputs

    %% Flow
    Event -->|"trigger workflow"| Workflow
    Workflow -->|"runs on"| Runner
    Runner -->|"git clone"| Checkout
    Checkout -->|"setup env"| Setup
    Setup -->|"fetch manifests"| Fetch
    Fetch -->|"device tree & manifest"| Patches
    Patches -->|"apply patches"| BuildScript
    BuildScript -->|"compile img"| Package
    Installer -->|"inject installer metadata"| Package
    RoomService -->|"inject RoomService metadata"| Package
    Package -->|"upload artifacts"| Upload

    %% Click Events
    click Workflow "https://github.com/adeveloper79/action-recovery-builder/blob/TWRP/.github/workflows/Recovery Build.yml"
    click BuildScript "https://github.com/adeveloper79/action-recovery-builder/blob/TWRP/scripts/convert.sh"
    click Installer "https://github.com/adeveloper79/action-recovery-builder/blob/TWRP/templates/installer.xml"
    click RoomService "https://github.com/adeveloper79/action-recovery-builder/blob/TWRP/templates/roomservice.xml"

    %% Styles
    classDef orchestration fill:#3b82f6,stroke:#1e40af,color:#ffffff
    classDef scripts fill:#10b981,stroke:#065f46,color:#ffffff
    classDef external fill:#f97316,stroke:#c2410c,color:#ffffff
    classDef outputs fill:#8b5cf6,stroke:#5b21b6,color:#ffffff
```
