Extract Blobs #5
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: Extract Blobs | |
on: | |
workflow_dispatch: | |
inputs: | |
FIRMWARE_DUMP_REPO: | |
description: 'Firmware Dump Repository URL' | |
required: true | |
default: 'https://gitlab.com/kelexine/tecno-spark-8c-kg5j-rom-dump.git' | |
FIRMWARE_DUMP_BRANCH: | |
description: 'Firmware Dump Repository Branch' | |
required: true | |
default: 'main' | |
DEVICE_TREE_REPO: | |
description: 'Device Tree Repository URL' | |
required: true | |
default: 'https://github.com/kelexine/android_device_tecno_KG5j' | |
DEVICE_TREE_BRANCH: | |
description: 'Device Tree Repository Branch' | |
required: true | |
default: 'android-11' | |
DEVICE_CODENAME: | |
description: 'Device Codename' | |
required: true | |
default: 'KG5j' | |
DEVICE_VENDORNAME: | |
description: 'Device Vendor Name' | |
required: true | |
default: 'tecno' | |
USER_NAME: | |
description: 'Name in Github Account' | |
required: true | |
default: 'kelexine' | |
USER_EMAIL: | |
description: 'E-mail in Github Account' | |
required: true | |
default: '[email protected]' | |
jobs: | |
build: | |
name: Extract Blobs by ${{ github.actor }} | |
if: github.event.repository.owner.id == github.event.sender.id | |
runs-on: ubuntu-20.04 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
FDR: ${{ github.event.inputs.FIRMWARE_DUMP_REPO }} | |
FDB: ${{ github.event.inputs.FIRMWARE_DUMP_BRANCH }} | |
DTR: ${{ github.event.inputs.DEVICE_TREE_REPO }} | |
DTB: ${{ github.event.inputs.DEVICE_TREE_BRANCH }} | |
DCN: ${{ github.event.inputs.DEVICE_CODENAME }} | |
DVN: ${{ github.event.inputs.DEVICE_VENDORNAME }} | |
UN: ${{ github.event.inputs.USER_NAME }} | |
UEM: ${{ github.event.inputs.USER_EMAIL }} | |
TR: android_vendor_${{ github.event.inputs.DEVICE_VENDORNAME }}_${{ github.event.inputs.DEVICE_CODENAME }} | |
permissions: | |
contents: write | |
steps: | |
- name: Check Out | |
uses: actions/checkout@v3 | |
- name: Set Swap Space | |
uses: pierotofy/set-swap-space@master | |
with: | |
swap-size-gb: 12 | |
- name: Prepare GithubCLI | |
run: | | |
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y) | |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ | |
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ | |
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ | |
&& sudo apt update \ | |
&& sudo apt install gh -y | |
- name: Identity | |
run: | | |
git config --global user.name "${{ env.UN }}" | |
git config --global user.email "${{ env.UEM }}" | |
- name: Clone Firmware Dump | |
run: | | |
mkdir workspace && cd workspace | |
git clone --depth=1 ${{ env.FDR }} -b ${{ env.FDB }} ./firmware-dump | |
- name: Clone Device Tree | |
run: | | |
cd workspace | |
git clone --depth=1 ${{ env.DTR }} -b ${{ env.DTB }} ./android/device/${{ env.DVN }}/${{ env.DCN }} | |
- name: Clone LineageOS Tools and Utils | |
run: | | |
cd workspace | |
git clone --depth=1 https://github.com/LineageOS/android_tools_extract-utils -b lineage-20.0 ./android/tools/extract-utils | |
echo "Done cloning extract-utils." | |
git clone --depth=1 https://github.com/LineageOS/android_prebuilts_extract-tools -b lineage-20.0 ./android/prebuilts/extract-tools | |
echo "Done cloning extract-tools." | |
- name: Extracting Files from Dump | |
run: | | |
cd workspace | |
chmod a+x android/device/${{ env.DVN }}/${{ env.DCN }}/setup-makefiles.sh | |
cd android/device/${{ env.DVN }}/${{ env.DCN }}/ | |
bash extract-files.sh ${GITHUB_WORKSPACE}/workspace/firmware-dump/ | |
echo "Done extracting and making files." | |
echo "Pushing as repository now." | |
- name: Push to Github as Repository | |
run: | | |
cd workspace/android/vendor/${{ env.DVN }}/${{ env.DCN }} | |
git init | |
git branch -M ${{ env.DCN }} | |
git add . | |
git commit -s -m "${{ env.DCN }}: proprietary: initial vendor tree" | |
gh repo create ${{ env.TR }} --public --description="Vendor tree for ${{ env.DCN }}." --source=. --remote=origin --push |