Generate TWRP Device Tree #54
Workflow file for this run
This file contains hidden or 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: Generate TWRP Device Tree | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| LIBRARY_NAME: | |
| description: 'Library name for the device tree' | |
| required: true | |
| default: 'Twrp_Device_Generator' | |
| IMG_URL: | |
| description: 'URL to recovery/boot image' | |
| required: true | |
| default: 'https://github.com/momo54181/action_build_twrp_device_tree/raw/main/recovery.img' | |
| jobs: | |
| generate-device-tree: | |
| if: github.event.repository.owner.id == github.event.sender.id | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up environment | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| python3 \ | |
| python3-pip \ | |
| cpio \ | |
| wget \ | |
| zip \ | |
| unzip | |
| - name: Install TWRP generator | |
| run: | | |
| pip3 install --upgrade twrpdtgen | |
| - name: Download recovery image | |
| run: | | |
| wget -O recovery.img "${{ github.event.inputs.IMG_URL }}" | |
| file recovery.img || true # Display file info for debugging | |
| - name: Generate device tree | |
| run: | | |
| mkdir -p device_tree_output | |
| python3 -m twrpdtgen \ | |
| -o device_tree_output \ | |
| recovery.img | |
| - name: Compress device tree | |
| run: | | |
| cd device_tree_output | |
| zip -r ../DeviceTree_${{ github.run_number }}.zip . | |
| cd .. | |
| - name: Create release with device tree | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: DeviceTree_${{ github.run_number }}.zip | |
| name: TWRP_Device_Tree_${{ github.run_number }} | |
| tag_name: dt-${{ github.run_number }} | |
| body: | | |
| Automatically generated TWRP device tree | |
| Build run: ${{ github.run_number }} | |
| Source image: ${{ github.event.inputs.IMG_URL }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |