ColorOS Stock Patch #22
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: ColorOS Stock Patch | |
on: | |
workflow_dispatch: | |
inputs: | |
ROM_URL: | |
description: 'ColorOS ROM' | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# You might want to Checkout your repo first, but not mandatory | |
- name: Check Out | |
uses: actions/checkout@v3 | |
- name: Cleanup | |
uses: rokibhasansagar/slimhub_actions@main | |
- name: Prepare the environment | |
run: | | |
sudo apt update | |
sudo apt -y upgrade | |
sudo apt -y install git zip unzip python3 python-is-python3 aria2 xxd openssl openjdk-17-jre-headless python3-protobuf p7zip-full -y | |
- name: Set Swap Space | |
uses: pierotofy/set-swap-space@master | |
with: | |
swap-size-gb: 12 | |
- name: Patch | |
run: | | |
mkdir -p input output | |
echo "workspace-folder=$(pwd)" >> $GITHUB_OUTPUT | |
aria2c -d input -o update.zip -j 5 -x 16 "${{ github.event.inputs.ROM_URL }}" | |
unzip "input/update.zip" -d input/ | |
echo "开始解压payload" | |
bin/payload-dumper-go -o IMAGES input/payload.bin >>/dev/null | |
info=$(bin/gettype -i IMAGES/system.img) | |
if [ "$info" == "ext" ]; then | |
echo "尝试使用7z解压" | |
7z x "IMAGES/system.img" -y -o"system/" | |
elif [ "$info" == "erofs" ]; then | |
echo "尝试使用erofs解压" | |
bin/fsck.erofs --extract="system" "IMAGES/system.img" | |
fi | |
rm -rf SYSTEM/* | |
cp system/system/build.prop SYSTEM | |
rm -rf system | |
xxd -r bin/hex1 > IMAGES/my_company.img | |
xxd -r bin/hex2 > IMAGES/my_preload.img | |
ls IMAGES/*.img > META/ab_partitions.txt | |
sed -i 's/IMAGES\///g' META/ab_partitions.txt | |
sed -i 's/.img//g' META/ab_partitions.txt | |
./repackZip.sh | |
split -b 1900M --numeric-suffixes --suffix-length=2 output/OTA.zip rom.z | |
echo "cat $(ls rom.z* | tr '\n' ' ') > newrom.zip" > Merge.sh | |
id: pwd | |
- name: Upload to Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
rom.z* | |
Merge.sh | |
name: ${{ github.run_id }} | |
tag_name: ${{ github.run_id }} | |
body: | | |
Link: ${{ github.event.inputs.ROM_URL }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |