44 schedule :
55 - cron : ' 0 0 * * *'
66 workflow_dispatch :
7- inputs :
8- force_update :
9- description : ' Force update'
10- required : false
11- type : boolean
12- default : false
137
148jobs :
15- get_rom_info :
9+ get_device_list :
1610 runs-on : ubuntu-latest
1711 outputs :
1812 matrix : ${{ steps.get_info.outputs.matrix }}
19- need_update : ${{ steps.get_info.outputs.need_update }}
20- ota_hash : ${{ steps.get_info.outputs.ota_hash }}
2113 steps :
2214 - name : Checkout repository
2315 uses : actions/checkout@v6
2416 with :
2517 fetch-depth : 1
2618 ref : bot
2719
28- - name : Get ROM info
20+ - name : Get device list
2921 id : get_info
3022 run : |
3123 download() { wget -T 20 --no-check-certificate "$1" -O "$2"; }
3224
3325 mkdir -p tmp && cd tmp
3426 download https://developer.android.com/about/versions PIXEL_VERSIONS_HTML
3527 download "$(grep -o 'https://developer.android.com/about/versions/.*[0-9]"' PIXEL_VERSIONS_HTML | sort -ru | cut -d\" -f1 | head -n1)" PIXEL_LATEST_HTML
36- download "https://developer.android.com$(grep -o 'href=".*download-ota .*"' PIXEL_LATEST_HTML | grep 'qpr' | cut -d\" -f2 | head -n1)" PIXEL_OTA_HTML
28+ download "https://developer.android.com$(grep -o 'href=".*download.*"' PIXEL_LATEST_HTML | grep 'qpr' | cut -d\" -f2 | head -n1)" PIXEL_FI_HTML
3729
3830 # Extract device information
39- grep -A1 'tr id=' PIXEL_OTA_HTML | grep 'td' | sed 's;.*<td>\(.*\)</td>;\1;' | sed 's/^[[:space:]]*//g;s/[[:space:]]*$//g' > MODEL_LIST
40- grep -o 'tr id="[^\"]*"' PIXEL_OTA_HTML | awk -F\" '{print $2 "_beta"}' | sed 's/^[[:space:]]*//g;s/[[:space:]]*$//g' > PRODUCT_LIST
41- for i in $(cat PRODUCT_LIST); do
42- OTA_LINK=$(grep "ota/$i" PIXEL_OTA_HTML | cut -d\" -f2 || echo "")
43- echo "$OTA_LINK" >> OTA_LIST
44- done
45-
46- CURRENT_HASH=$(sha256sum OTA_LIST | cut -d' ' -f1)
47- LAST_HASH=$(cat ../HASH || echo '')
48-
49- if [ "$CURRENT_HASH" == "$LAST_HASH" ] && [ "${{ github.event.inputs.force_update }}" != "true" ]; then
50- echo "need_update=false" >> $GITHUB_OUTPUT
51- echo "matrix={}" >> $GITHUB_OUTPUT
52- echo "ota_hash=$CURRENT_HASH" >> $GITHUB_OUTPUT
53- else
54- echo "need_update=true" >> $GITHUB_OUTPUT
55- matrix_json=$(paste -d ',' MODEL_LIST PRODUCT_LIST OTA_LIST | jq -R 'split(",") | {model: .[0], product: .[1], ota_link: .[2]}' | jq -s '{include: [.[] | select(.ota_link != "")]}' | jq -c .)
56- echo "matrix=$matrix_json" >> $GITHUB_OUTPUT
57- echo "ota_hash=$CURRENT_HASH" >> $GITHUB_OUTPUT
58- fi
31+ grep -A1 'tr id=' PIXEL_FI_HTML | grep 'td' | sed 's;.*<td>\(.*\)</td>;\1;' | sed 's/^[[:space:]]*//g;s/[[:space:]]*$//g' > MODEL_LIST
32+ grep -o 'tr id="[^\"]*"' PIXEL_FI_HTML | awk -F\" '{print $2 "_beta"}' | sed 's/^[[:space:]]*//g;s/[[:space:]]*$//g' > PRODUCT_LIST
33+
34+ matrix_json=$(paste MODEL_LIST PRODUCT_LIST | jq -R 'split("\t") | {model: .[0], product: .[1]}' | jq -s '{include: .}' | jq -c .)
35+ echo "matrix=$matrix_json" >> $GITHUB_OUTPUT
5936
6037 process_rom :
61- needs : get_rom_info
62- if : needs.get_rom_info.outputs.need_update == 'true'
38+ needs : get_device_list
6339 runs-on : ubuntu-latest
6440 strategy :
6541 fail-fast : false
66- matrix : ${{ fromJson(needs.get_rom_info .outputs.matrix) }}
42+ matrix : ${{ fromJson(needs.get_device_list .outputs.matrix) }}
6743
6844 steps :
6945 - name : Checkout repository
7248 fetch-depth : 1
7349 ref : bot
7450
75- - name : Set up Python
76- uses : actions/setup-python@v6
77- with :
78- python-version : ' 3.x'
79-
80- - name : Install dependencies
81- run : |
82- python -m pip install --upgrade pip
83- pip install git+https://github.com/5ec1cff/payload-dumper
84-
8551 - name : Process ROM
8652 uses : nick-invision/retry@v3
8753 with :
@@ -90,14 +56,26 @@ jobs:
9056 command : |
9157 model="${{ matrix.model }}"
9258 product="${{ matrix.product }}"
93- ota_link="${{ matrix.ota_link }}"
9459
9560 mkdir -p tmp && cd tmp
9661
97- # Get other information
98- payload_dumper --metadata --out . "$ota_link"
99- FINGERPRINT=$(grep -am1 'post-build=' metadata | cut -d= -f2)
100- SECURITY_PATCH=$(grep -am1 'security-patch-level=' metadata | cut -d= -f2)
62+ # Get device fingerprint and security patch from Flash Tool and bulletins
63+ DEVICE="$(echo "$product" | sed 's/_beta//')"
64+ wget -T 20 --no-check-certificate https://flash.android.com -O PIXEL_FLASH_HTML
65+ FLASH_KEY=$(grep -o '<body data-client-config=.*' PIXEL_FLASH_HTML | cut -d\; -f2 | cut -d\& -f1)
66+ curl -H "Referer: https://flash.android.com" -s "https://content-flashstation-pa.googleapis.com/v1/builds?product=$product&key=$FLASH_KEY" > PIXEL_STATION_JSON
67+ CANARY_LATEST_JSON="$(tac PIXEL_STATION_JSON | grep -m1 -A13 'canary')"
68+ ID="$(echo "$CANARY_LATEST_JSON" | grep 'releaseCandidateName' | cut -d\" -f4)"
69+ INCREMENTAL="$(echo "$CANARY_LATEST_JSON" | grep 'buildId' | cut -d\" -f4)"
70+ FINGERPRINT="google/$product/$DEVICE:CANARY/$ID/$INCREMENTAL:user/release-keys"
71+ wget -T 20 --no-check-certificate https://source.android.com/docs/security/bulletin/pixel -O PIXEL_SECBULL_HTML
72+ SECBULL_ID="$(echo "$CANARY_LATEST_JSON" | grep '"id"' | sed -e 's;.*canary-\(.*\)".*;\1;' -e 's;^\(.\{4\}\);\1-;')"
73+ SECURITY_PATCH="$(grep "<td>$SECBULL_ID" PIXEL_SECBULL_HTML | sed 's;.*<td>\(.*\)</td>;\1;')"
74+
75+ if [ -z "$ID" ] || [ -z "$INCREMENTAL" ] || [ -z "$SECURITY_PATCH" ]; then
76+ echo "! Failed to get pif.prop for $product"
77+ exit 1
78+ fi
10179
10280 cat <<EOF > ../${product}.prop
10381 FINGERPRINT=$FINGERPRINT
11391 path : ${{ matrix.product }}.prop
11492
11593 commit_and_push :
116- needs : [get_rom_info, process_rom]
117- if : needs.get_rom_info.outputs.need_update == 'true'
94+ needs : [get_device_list, process_rom]
11895 runs-on : ubuntu-latest
11996 steps :
12097 - name : Checkout repository
@@ -131,21 +108,24 @@ jobs:
131108 uses : actions/download-artifact@v7
132109 with :
133110 path : device_prop
134-
111+
135112 - name : Flatten artifacts
136113 run : |
137114 find device_prop -mindepth 2 -type f -exec mv -t device_prop/ {} +
138115 find device_prop -type d -empty -delete
139116
140- - name : Export formatted device list and new hash
117+ - name : Export formatted device list
141118 run : |
142- echo '${{ needs.get_rom_info.outputs.matrix }}' | jq '.include | map({model, product})' > device_list.json
143- echo '${{ needs.get_rom_info.outputs.ota_hash }}' > HASH
119+ echo '${{ needs.get_device_list.outputs.matrix }}' | jq '.include | map({model, product})' > device_list.json
144120
145121 - name : Commit and Push
146122 run : |
147123 git config --global user.email "github-actions[bot]@users.noreply.github.com"
148124 git config --global user.name "github-actions[bot]"
149125
150- git add device_prop/. device_list.json HASH
151- git commit -m "update device list" && git push
126+ git add device_prop/. device_list.json
127+ if git diff --cached --quiet; then
128+ echo "No changes to commit"
129+ else
130+ git commit -m "update device list" && git push
131+ fi
0 commit comments