Skip to content

Commit fc02a08

Browse files
authored
Update Device-Tree-Generator.yml
1 parent 64fa82d commit fc02a08

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

.github/workflows/Device-Tree-Generator.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,11 @@ on:
2323
description: 'your commit message'
2424
required: true
2525
default: 'TWRP device tree'
26-
IMG_TYPE:
27-
description: 'your img type'
26+
PUSH_GITHUB:
27+
description: 'Push to GitHub Repository.'
28+
type: boolean
2829
required: true
29-
default: 'recovery'
30-
type: choice
31-
options:
32-
- boot
33-
- recovery
34-
- vendor_boot
30+
default: false
3531
RELEASE_FILE:
3632
description: 'Upload file to GitHub Release too.'
3733
type: boolean
@@ -59,23 +55,40 @@ jobs:
5955
- name: Downloading .img file
6056
run: |
6157
wget ${{ github.event.inputs.DEVICE_IMG }}
58+
if [ -f ./recovery.img ]; then
59+
echo "RECOVERY_TYPE=recovery" >> $GITHUB_ENV
60+
echo "recovery.img file found!"
61+
elif [ -f ./boot.img ]; then
62+
echo "RECOVERY_TYPE=boot" >> $GITHUB_ENV
63+
echo "boot.img file found!"
64+
elif [ -f ./vendor_boot.img ]; then
65+
echo "RECOVERY_TYPE=vendor_boot" >> $GITHUB_ENV
66+
echo "vendor_boot.img file found!"
67+
else
68+
echo "No Recovery file found!"
69+
cd Exit
70+
fi
6271
6372
- name: Generating Device tree
6473
run: |
65-
python3 -m twrpdtgen ./${{ github.event.inputs.IMG_TYPE }}.img
74+
python3 -m twrpdtgen ./${{ env.RECOVERY_TYPE }}.img
6675
6776
- name: Set Build Date
6877
run: |
6978
echo "BUILD_DATE=$(date +%Y%m%d)" >> $GITHUB_ENV
7079
71-
- name: Add to Zip
80+
- name: getting device information
7281
run: |
7382
mv ./output/ device
74-
zip -r ${{ env.DEVICE_ID }}_${{ env.DEVICE_IDD }}_tree.zip ./device/
7583
cd device/*/
7684
echo "DEVICE_ID=${PWD##*/}" >> $GITHUB_ENV
7785
cd *
7886
echo "DEVICE_IDD=${PWD##*/}" >> $GITHUB_ENV
87+
88+
- name: Add to Zip
89+
run: |
90+
zip -r ${{ env.DEVICE_ID }}_${{ env.DEVICE_IDD }}_tree.zip ./device/
91+
7992
- name: Release
8093
if: github.event.inputs.RELEASE_FILE == 'true'
8194
uses: softprops/action-gh-release@v1
@@ -87,6 +100,7 @@ jobs:
87100
body: |
88101
89102
- name: Push to GitHub
103+
if: github.event.inputs.PUSH_GITHUB == 'true'
90104
run: |
91105
git config --global user.email "Samuel Kendall"
92106
git config --global user.name "[email protected]"

0 commit comments

Comments
 (0)