Skip to content

Commit e915066

Browse files
committed
Update
1 parent 9434279 commit e915066

File tree

2 files changed

+71
-64
lines changed

2 files changed

+71
-64
lines changed

.github/workflows/main.yml

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
11
name: Extract and Release
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
ROM_URL:
7-
description: "ROM_URL"
8-
default: "https://pixeldrain.com/api/file/WdArNVpq"
9-
DEVICE_NAME:
10-
description: "DEVICE_NAME"
11-
default: "spes"
12-
EXTRACTED_FILES:
13-
description: "EXTRACTED_FILES"
14-
default: "boot.img, dtbo.img, product.img, system.img, system_ext.img"
4+
workflow_dispatch:
5+
inputs:
6+
ROM_URL:
7+
description: "ROM_URL"
8+
default: "https://pixeldrain.com/api/file/WdArNVpq"
9+
DEVICE_NAME:
10+
description: "DEVICE_NAME"
11+
default: "spes"
12+
EXTRACTED_FILES:
13+
description: "EXTRACTED_FILES"
14+
default: "boot.img, dtbo.img, product.img, system.img, system_ext.img"
1515

1616
jobs:
17-
build-and-release:
18-
runs-on: ubuntu-latest
19-
permissions: write-all
20-
steps:
21-
- name: Checkout code
22-
uses: actions/checkout@v3
17+
build-and-release:
18+
runs-on: ubuntu-latest
19+
permissions: write-all
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
2323

24-
- name: Download file
25-
run: curl -LJO ${{ github.event.inputs.ROM_URL }}
24+
- name: Download file
25+
run: curl -LJO ${{ github.event.inputs.ROM_URL }}
2626

27-
- name: Extract Payload
28-
run: |
29-
chmod u+x .github/scripts/android-ota-extractor
30-
.github/scripts/android-ota-extractor *.zip
31-
echo -e "\n\e[31mDeleting files larger than 2GB...\e[0m"
32-
find . -maxdepth 1 -type f -size +2G -print -delete
33-
echo "ZIP_FILE=$(basename -a *.zip)" >> $GITHUB_ENV
34-
echo "ZIP_FILE_SHA256=$(sha256sum *.zip | cut -d' ' -f1)" >> $GITHUB_ENV
27+
- name: Extract Payload
28+
run: |
29+
chmod u+x .github/scripts/android-ota-extractor
30+
.github/scripts/android-ota-extractor *.zip
31+
echo -e "\n\e[31mDeleting files larger than 1.95 GB (2000 MB)...\e[0m"
32+
find . -maxdepth 1 -type f -size +2097152000c -print -delete
33+
echo "ZIP_FILE=$(basename -a *.zip)" >> $GITHUB_ENV
34+
echo "ZIP_FILE_SHA256=$(sha256sum *.zip | cut -d' ' -f1)" >> $GITHUB_ENV
3535
36-
- name: Upload to Release
37-
uses: softprops/action-gh-release@v1
38-
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
with:
41-
files: ${{ github.event.inputs.EXTRACTED_FILES }}
42-
name: ${{ github.event.inputs.DEVICE_NAME }}-${{ github.run_id }}
43-
tag_name: ${{ github.run_id }}
44-
body: |
45-
Device: ${{ github.event.inputs.DEVICE_NAME }}
46-
Filename: [${{ env.ZIP_FILE }}](${{ github.event.inputs.ROM_URL }})
47-
Extracted files: ${{ github.event.inputs.EXTRACTED_FILES }}
48-
SHA256: ${{ env.ZIP_FILE_SHA256 }}
36+
- name: Upload to Release
37+
uses: softprops/action-gh-release@v2
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
with:
41+
files: ${{ github.event.inputs.EXTRACTED_FILES }}
42+
name: ${{ github.event.inputs.DEVICE_NAME }}-${{ github.run_id }}
43+
tag_name: ${{ github.run_id }}
44+
body: |
45+
Device: ${{ github.event.inputs.DEVICE_NAME }}
46+
Filename: [${{ env.ZIP_FILE }}](${{ github.event.inputs.ROM_URL }})
47+
Extracted files: ${{ github.event.inputs.EXTRACTED_FILES }}
48+
SHA256: ${{ env.ZIP_FILE_SHA256 }}

README.md

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,45 @@
33
This GitHub Actions workflow allows you to automatically extract and release specific files from a ROM URL.
44

55
## Inputs
6+
67
The following inputs are required when triggering the workflow:
78

8-
- `ROM_URL`: The URL of the ROM file to be extracted and released.
9-
- `DEVICE_NAME`: The name of the device for which the ROM is intended.
10-
- `ROM_NAME`: The name of the ROM.
11-
- `EXTRACTED_FILES`: A comma-separated list of files to be extracted from the ROM and included in the release. Available files may include:
12-
13-
- "boot.img" - The boot image, which contains the kernel and recovery.
14-
- "dtbo.img" - The device tree binary image, which contains information about the device's hardware.
15-
- "product.img" - The product image, which contains the system's product-specific properties.
16-
- "system.img" - The system image, which contains the system partition.
17-
- "system_ext.img" - The system_ext image, which contains the system_ext partition.
18-
- "vbmeta.img" - The vbmeta image, which contains verified boot metadata.
19-
- "vbmeta_system.img" - The vbmeta_system image, which contains verified boot metadata for the system partition.
20-
- "vendor.img" - The vendor image, which contains the vendor partition.
21-
- "vendor_boot.img" - The vendor boot image, which contains the vendor-specific kernel and ramdisk.
9+
- `ROM_URL`: The URL of the ROM file to be extracted and released.
10+
- `DEVICE_NAME`: The name of the device for which the ROM is intended.
11+
- `EXTRACTED_FILES`: A comma-separated list of files to be extracted from the ROM and included in the release. Available files may include:
12+
13+
- "boot.img" - The boot image, which contains the kernel and recovery.
14+
- "dtbo.img" - The device tree binary image, which contains information about the device's hardware.
15+
- "product.img" - The product image, which contains the system's product-specific properties.
16+
- "system.img" - The system image, which contains the system partition.
17+
- "system_ext.img" - The system_ext image, which contains the system_ext partition.
18+
- "vbmeta.img" - The vbmeta image, which contains verified boot metadata.
19+
- "vbmeta_system.img" - The vbmeta_system image, which contains verified boot metadata for the system partition.
20+
- "vendor.img" - The vendor image, which contains the vendor partition.
21+
- "vendor_boot.img" - The vendor boot image, which contains the vendor-specific kernel and ramdisk.
2222

2323
## Steps
24+
2425
The workflow is composed of the following steps:
2526

26-
1. Checkout code: check out the repository code.
27-
2. Download file: download the file specified by the ROM_URL input.
28-
3. Unzip file: unzip the downloaded file to a directory named "extracted_files/".
29-
4. Setup Python: set up a version of Python.
30-
5. Install OTA Extractor: download and install the OTA Extractor package.
31-
6. Extract Payload: extract payload from the downloaded file and output it to the current directory.
32-
7. Upload to Release: upload the specified files (EXTRACTED_FILES input) to a GitHub release with a name that includes the DEVICE_NAME and run_id, a tag with the run_id, and a body that includes information about the device, ROM, and extracted files.
27+
1. Checkout code: Check out the repository code.
28+
2. Download file: Download the file specified by the ROM_URL input.
29+
3. Extract Payload: Extract the payload from the downloaded file and output it to the current directory. Additionally, files larger than 2GB will be automatically deleted to comply with GitHub release restrictions, as files larger than 2GB are not allowed.
30+
4. Upload to Release: Uploads specified files to a GitHub release.
3331

3432
## Usage
35-
To use this workflow, create a new GitHub Actions workflow in your repository and copy the contents of [main.yml](https://github.com/your-repo/main.yml) into the file. Update the inputs with your desired values, and configure any necessary secrets. You can then trigger the workflow manually using the "workflow_dispatch" event.
33+
34+
1. Fork this repository to your GitHub account.
35+
2. Go to the "Actions" tab in your forked repository.
36+
3. Enable GitHub Actions for the repository if it's not already enabled.
37+
4. Select the workflow named "Extract and Release" from the list of workflows.
38+
5. Click on the "Run workflow" dropdown button and select the "Run workflow" option.
39+
6. Enter the required inputs:
40+
- `ROM_URL`: The URL of the ROM file to be extracted and released.
41+
- `DEVICE_NAME`: The name of the device for which the ROM is intended.
42+
- `EXTRACTED_FILES`: A comma-separated list of files to be extracted from the ROM and included in the release (e.g., "boot.img, dtbo.img, product.img").
43+
7. Click the "Run workflow" button to trigger the workflow with the provided inputs.
3644

3745
## Note
38-
The OTA Extractor package that is used in this workflow is taken from https://github.com/sakshiagrwal/OTAExtractor, it is cloned, a specific version of protobuf library is installed, and `HEAD~1` is reset to avoid breaking changes. So you can be sure that the package version you are using is compatible with the script.
3946

40-
Additionally, it is important to note that in order to use the `Upload to Release` step, you need to have the `GITHUB_TOKEN` available as a secret in your repository.
47+
The OTA Extractor package that is used in this workflow is taken from https://github.com/tobyxdd/android-ota-payload-extractor.

0 commit comments

Comments
 (0)