PitchBlack Recovery Project Builder #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PitchBlack Recovery Project Builder | |
on: | |
workflow_dispatch: | |
inputs: | |
MANIFEST_BRANCH: | |
description: 'PBRP Manifest Branch' | |
required: true | |
default: 'android-12.1' | |
type: choice | |
options: | |
- android-14.0 | |
- android-12.1 | |
- android-11.0 | |
- android-10.0 | |
- android-9.0 | |
- android-8.1 | |
- android-7.1 | |
- android-6.0 | |
DEVICE_TREE: | |
description: 'Custom Recovery Tree URL' | |
required: true | |
default: 'https://github.com/enter_username/repo_name' | |
DEVICE_TREE_BRANCH: | |
description: 'Device Tree Branch' | |
required: true | |
default: 'main' | |
DEVICE_NAME: | |
description: 'Device Codename' | |
required: true | |
DEVICE_PATH: | |
description: 'Device Path (from BoardConfig.mk)' | |
required: true | |
default: 'device/manufacturer/codename' | |
BUILD_TARGET: | |
description: 'Build Target (use "pbrp" for Android 11+)' | |
required: true | |
default: 'recovery' | |
type: choice | |
options: | |
- pbrp | |
- recovery | |
- boot | |
- vendorboot | |
LDCHECK: | |
description: 'Run dependency check' | |
required: false | |
default: false | |
type: boolean | |
LDCHECKPATH: | |
description: 'Path for dependency check' | |
required: true | |
default: 'recovery/root/system/bin/qseecomd' | |
jobs: | |
build: | |
name: Build PBRP by ${{ github.actor }} | |
runs-on: ubuntu-latest | |
if: github.event.repository.owner.id == github.event.sender.id | |
env: | |
OUTPUT_DIR: ${{ github.workspace }}/android-recovery/out/target/product/${{ inputs.DEVICE_NAME }} | |
DEBIAN_FRONTEND: noninteractive | |
permissions: | |
contents: write | |
steps: | |
- name: Initial Setup | |
run: | | |
echo "BUILD_START=$(date +%s)" >> $GITHUB_ENV | |
echo "BUILD_DATE=$(TZ=UTC date +%Y%m%d)" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Clean-up | |
uses: rokibhasansagar/slimhub_actions@main | |
- name: Swap Space # Easier | |
uses: pierotofy/set-swap-space@master | |
with: | |
swap-size-gb: 24 | |
- name: Build PitchBlack Recovery | |
uses: mlm-games/pitchblack-pbrp-builder-action@main | |
id: build | |
with: | |
MANIFEST_BRANCH: 'android-12.1' | |
DEVICE_TREE: 'https://github.com/mlm-games/twrp_galaxy_m02s' | |
DEVICE_TREE_BRANCH: 'pbrp' | |
BUILD_TARGET: 'pbrp' | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
if: inputs.upload_releases == false || github.event_name != 'workflow_dispatch' | |
with: | |
name: TWRP-Recovery-${{ env.DEVICE_NAME }}-${{ env.COMMIT_SHORT }} | |
path: | | |
${{ env.OUTPUT_DIR }}/*.img | |
${{ env.OUTPUT_DIR }}/*.tar | |
${{ env.OUTPUT_DIR }}/*vbmeta* | |
${{ env.OUTPUT_DIR }}/*.cpio | |
- name: Upload to Release | |
if: success() | |
uses: softprops/action-gh-release@master | |
with: | |
files: | | |
${{ env.OUTPUT_DIR }}/*.img | |
${{ env.OUTPUT_DIR }}/PBRP*.zip | |
${{ env.OUTPUT_DIR }}/ramdisk-recovery.* | |
name: PBRP for ${{ inputs.DEVICE_NAME }} - ${{ env.BUILD_DATE }} | |
tag_name: ${{ github.run_id }} | |
body: | | |
## Build Information | |
- **Build Date:** ${{ env.BUILD_DATE }} | |
- **Branch:** ${{ inputs.MANIFEST_BRANCH }} | |
- **Device:** ${{ inputs.DEVICE_NAME }} | |
- **Build Type:** ${{ inputs.BUILD_TARGET }} | |
## Source Information | |
- **Device Tree:** [${{ inputs.DEVICE_TREE }}](${{ inputs.DEVICE_TREE }}/tree/${{ inputs.DEVICE_TREE_BRANCH }}) | |
- **Branch:** ${{ inputs.DEVICE_TREE_BRANCH }} | |
- **Commit:** [${{ env.COMMIT_ID }}](${{ inputs.DEVICE_TREE }}/commit/${{ env.COMMIT_ID }}) | |
## Build Status | |
- Recovery Image MD5: `${{ env.MD5_IMG }}` | |
- ZIP Package MD5: `${{ env.MD5_ZIP }}` | |
> Note: This is an automated build. Please test thoroughly before using. | |
prerelease: true | |
draft: false | |
- name: Run LDCHECK | |
uses: mlm-games/ldcheck-action@main | |
with: | |
OUTPUT_DIR: ${{ env.OUTPUT_DIR }} | |
LDCHECKPATH: ${{ inputs.LDCHECK_PATH }} | |
- name: Calculate Build Time | |
if: always() | |
run: | | |
BUILD_END=$(date +%s) | |
BUILD_DURATION=$((BUILD_END - BUILD_START)) | |
hours=$((BUILD_DURATION / 3600)) | |
minutes=$(((BUILD_DURATION % 3600) / 60)) | |
seconds=$((BUILD_DURATION % 60)) | |
echo "Build completed in ${hours}h ${minutes}m ${seconds}s" | |
# Save build statistics | |
echo "BUILD_DURATION=${BUILD_DURATION}" >> $GITHUB_ENV | |
echo "BUILD_HOURS=${hours}" >> $GITHUB_ENV | |
echo "BUILD_MINUTES=${minutes}" >> $GITHUB_ENV | |
echo "BUILD_SECONDS=${seconds}" >> $GITHUB_ENV | |
- name: Upload Build Logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-logs-${{ inputs.DEVICE_NAME }}-${{ env.BUILD_DATE }} | |
path: | | |
${{ env.OUTPUT_DIR }}/*.log | |
${{ env.OUTPUT_DIR }}/log | |
retention-days: 5 | |
- name: Cleanup Workspace | |
if: always() | |
run: | | |
cd ${{ github.workspace }} | |
rm -rf android-recovery | |
df -h |