MTK Rom Dumper #60
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: MTK Rom Dumper | |
on: | |
workflow_dispatch: | |
inputs: | |
DOWNLOAD_URL: | |
description: 'DOWNLOAD_URL' | |
required: true | |
default: 'https://github.com/kelexine/recovery-releases/releases/download/v4.1.1/kg5j-rom.tar.xz' | |
DEVICE_NAME: | |
description: 'DEVICE_NAME' | |
required: true | |
default: 'TECNO SPARK 8C KG5j' | |
ROM_TYPE: | |
description: 'ROM_TYPE' | |
required: true | |
default: 'STOCK ROM' | |
FILES_TYPE: | |
description: 'FILES_TYPE' | |
required: true | |
default: 'ALL ROM FILES' | |
DIR_NAME: | |
description: 'DIR_NAME' | |
required: true | |
default: 'rom' | |
ARCHIVE_NAME: | |
description: 'ARCHIVE_NAME' | |
required: true | |
default: 'archive.tar.xz' | |
jobs: | |
build: | |
if: github.event.repository.owner.id == github.event.sender.id | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: write | |
steps: | |
- name: Check Out | |
uses: actions/checkout@v3 | |
- name: Prepare the environment | |
run: | | |
sudo apt update | |
sudo apt install git aria2 wget tar simg2img python3 -y | |
- name: Download Archive | |
run: | | |
mkdir -p ${{ github.event.inputs.DIR_NAME }} | |
cd ${{ github.event.inputs.DIR_NAME }} | |
curl -L -o ${{ github.event.inputs.ARCHIVE_NAME }} ${{ github.event.inputs.DOWNLOAD_URL }} | |
ls -lah | |
- name: Extract and Cleanup | |
run: | | |
cp extract.sh ${{ github.event.inputs.DIR_NAME }} || echo "extract.sh not found. Proceeding without it." | |
cd ${{ github.event.inputs.DIR_NAME }} | |
tar -xJf ${{ github.event.inputs.ARCHIVE_NAME }} | |
wget http://newandroidbook.com/tools/imjtool.tgz && tar xzvf imjtool.tgz | |
simg2img super.img super.ext.img || echo "simg2img failed. Proceeding without it." | |
./imjtool.ELF64 super.ext.img extract || echo "imjtool extraction failed. Proceeding without it." | |
mv extracted/*.img . || echo "No extracted images found. Proceeding without them." | |
xz -z system_a.img system_ext_a.img product_a.img vendor_a.img || echo "Compression failed. Proceeding without it." | |
rm -f super.ext.img super.img ${{ github.event.inputs.ARCHIVE_NAME }} || echo "Cleanup failed. Proceeding without it." | |
- name: Upload to Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
${{ github.event.inputs.DIR_NAME }}/* | |
name: ${{ github.event.inputs.DEVICE_NAME }}-${{ github.run_id }} | |
tag_name: ${{ github.run_id }} | |
body: | | |
Type: ${{ github.event.inputs.FILES_TYPE }} | |
Device: ${{ github.event.inputs.DEVICE_NAME }} | |
Target: ${{ github.event.inputs.ROM_TYPE }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cleanup Environment | |
run: | | |
rm -rf ${{ github.event.inputs.DIR_NAME }} |