Skip to content

Commit

Permalink
✅ 代码重构
Browse files Browse the repository at this point in the history
  • Loading branch information
armv7a committed May 9, 2024
1 parent a3b4e4b commit ceda2a1
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 56 deletions.
Binary file removed .DS_Store
Binary file not shown.
Binary file removed .github/.DS_Store
Binary file not shown.
Binary file removed .github/workflows/.DS_Store
Binary file not shown.
65 changes: 37 additions & 28 deletions .github/workflows/BootIMGExtractAction.yml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,51 +1,60 @@
name: 提取 boot / init_boot.img
name: extract_partition

on:
workflow_dispatch:
inputs:
boot:
description: '是否提取 boot 分区?'
required: false
default: false
type: boolean
init_boot:
description: '是否提取 init_boot 分区?'
required: false
default: false
type: boolean
rom_url:
description: 'ROM 下载直链'
required: true
default: 'https://mirrorbits.lineageos.org/full/tissot/20230425/lineage-19.1-20230425-nightly-tissot-signed.zip'

default: 'https://cdnorg.d.miui.com/OS1.0.3.0.UNOCNXM/miui_ZIRCON_OS1.0.3.0.UNOCNXM_e09092107e_14.0.zip'

jobs:
YIJIANTIQU:
extract_partition:
runs-on: ubuntu-latest
steps:
- name: 检出代码
uses: actions/checkout@v2

- name: 安装依赖
run: |
sudo apt-get update
sudo apt-get -y install python3-pip
sudo apt install aria2 liblzma-dev brotli lz4
pip3 install backports.lzma pycrypto
pip install protobuf==3.20
BUILD_TIME=$(TZ=Asia/Shanghai date +"%m%d%H%M")
echo "BUILD_TIME=$BUILD_TIME" >> $GITHUB_ENV
sudo apt-get update && sudo apt-get -y install python3 python3-pip
sudo pip3 install bsdiff4 enlighten protobuf==3.20 httpx
git clone --single-branch --depth=1 https://github.com/5ec1cff/payload-dumper ~/payload-dumper_temp
mv ~/payload-dumper_temp/payload_dumper ~/payload-dumper
rm -rf ~/payload-dumper_temp
- name: 提取镜像并上传至 TMP
- name: 提取镜像
run: |
cd ~
git clone --recurse-submodules https://github.com/tosasitill/Firmware_extractor.git
cd Firmware_extractor
aria2c -s 10 -x 10 -d . -o firmware.zip "${{ github.event.inputs.rom_url }}"
./extractor.sh firmware.zip
cd ${{ github.workspace }}
touch info.md
echo "提交日期:$(TZ=Asia/Shanghai date '+%Y-%m-%d %H:%M:%S')" >> info.md
echo "ROM 下载直链:${{ github.event.inputs.rom_url }}" >> info.md
cd ~/Firmware_extractor/out
if [ -f "init_boot.img" ]; then rm boot.img; fi
du -h --total *.img | sed 's/^/提取镜像大小: /' | head -n 1 >> ${{ github.workspace }}/info.md
partitions=""
if [ "${{ github.event.inputs.boot }}" == "true" ]; then partitions="$partitions,boot"; fi
if [ "${{ github.event.inputs.init_boot }}" == "true" ]; then partitions="$partitions,init_boot"; fi
if [ -z "$partitions" ]; then echo "请选择至少一个分区类型!"; exit 1; fi
cd ~ && python3 ~/payload-dumper/dumper.py --partitions "${partitions:1}" ${{ github.event.inputs.rom_url }}
- name: 生成信息文件
run: |
cd ~/output
echo "提交日期:$(TZ=Asia/Shanghai date '+%Y-%m-%d %H:%M:%S')" >> ${{ github.workspace }}/info.md
echo "ROM 下载直链:${{ github.event.inputs.rom_url }}" >> ${{ github.workspace }}/info.md
echo "提取的镜像大小:" >> ${{ github.workspace }}/info.md
for img_file in *.img; do
echo "$(du -h "$img_file" | awk '{print $1}') $img_file" >> ${{ github.workspace }}/info.md
done
- name: 上传镜像及相关信息
uses: ncipollo/[email protected]
with:
artifacts: "~/Firmware_extractor/out/*"
artifacts: "~/output/*"
bodyfile: "${{ github.workspace }}/info.md"
tag: "OUTPUT_${{ env.BUILD_TIME }}_${{ github.run_id }}"
token: ${{ secrets.GITHUB_TOKEN }}

token: ${{ secrets.GITHUB_TOKEN }}
Empty file modified LICENSE
100644 → 100755
Empty file.
43 changes: 15 additions & 28 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,42 +1,29 @@
![image](./info.png)

This action extract boot.img / init_boot.img and upload them to the Releases
# BootIMGExtractAction

## Usage

Fork this action and fill in the link to complete the process. Don't forget to change your github action 'Workflow permissions' to 'Read and write permissions' and

**Supported ROM types only 'Recovery flashable ROM'**
**Please go to the personal repository's settings, then add a secret in Actions named 'app_token' with a value of 'TMP', and save it**

## Others

Special thanks to [ShivamKumarJha](https://github.com/ShivamKumarJha)[Suhun Han](https://github.com/ssut)
This action extracts boot.img / init_boot.img from a ROM and uploads them to the Releases section.

This repo depends on [Firmware_extractor](https://github.com/ShivamKumarJha/Firmware_extractora)[payload-dumper-go](https://github.com/ssut/payload-dumper-go)
---

Test Date: April 23rd, 2023
English | [简体中文](./README_CN.md)

## Usage

# 中文版本

这是一个用来提取 ROM 内 boot.img / init_boot.img 的 Github Action 项目

## 使用方法

Fork 本仓库,在 Action 界面内选择 “提取 boot.img / init_boot.img”,然后点击 “Run workflow”,填入 ROM 下载直链,等待完成。

**如果遇到 “403 资源访问受限”,请去 Settings-Actions-General-Workflow permissions,将它调整至 “Read and write permissions”**
1. Fork this repository.
2. In the Actions tab, select either 'boot' or 'init_boot', and provide the direct download link to your ROM.
3. Click on "Run workflow" and wait for the process to complete.

**本项目仅支持卡刷包/Recovery ROM**
**If you encounter a "403 Forbidden" error, go to Settings > Actions > General > Workflow permissions and adjust it to "Read and write permissions".**

**请去个人仓库内设置-Secret-Action-Add 以 app_token 为 value 'TMP'为名称 填入保存**
**This project only supports 'Recovery ROM'.**

**To ensure functionality, add a secret named 'app_token' in your personal repository's Settings > Secrets > Actions. Set its value to 'TMP'.**

## 其他
## Others

特别感谢 [ShivamKumarJha](https://github.com/ShivamKumarJha)[Suhun Han](https://github.com/ssut)
Special thanks to [tosasitill](https://github.com/tosasitill) and [5ec1cff](https://github.com/5ec1cff).

本项目依赖于 [Firmware_extractor](https://github.com/ShivamKumarJha/Firmware_extractora)[payload-dumper-go](https://github.com/ssut/payload-dumper-go)
This project relies on [payload-dumper](https://github.com/5ec1cff/payload-dumper).

最后测试通过时间: 2023年4月23日
Tested on: May 9, 2024
27 changes: 27 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# BootIMGExtractAction

这是一个用来提取 ROM 内 boot.img / init_boot.img 的 GitHub Action 项目。

---

[English](./README.md) | 简体中文

## 使用方法

1. Fork 本仓库。
2. 在 Actions 界面内,选择 'boot' 或 'init_boot',并提供 ROM 的下载直链。
3. 点击“Run workflow”并等待流程完成。

**如果遇到 “403 资源访问受限”,请去 Settings-Actions-General-Workflow permissions,将它调整至 “Read and write permissions”**

**本项目仅支持 '卡刷包/Recovery ROM'。**

**请去个人仓库内设置-Secret-Action-Add 以 app_token 为 value 'TMP'为名称 填入保存**

## 其他

特别感谢 [tosasitill](https://github.com/tosasitill)[5ec1cff](https://github.com/5ec1cff)

本项目依赖于 [payload-dumper](https://github.com/5ec1cff/payload-dumper)

最后测试通过时间: 2024年5月9日

0 comments on commit ceda2a1

Please sign in to comment.