diff --git a/.gitignore b/.gitignore index 1f0d17a6..890d4987 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ nginx-tmp node_modules static-tmp +releases-base diff --git a/process-static b/process-static index 86e41fcf..88f04d04 100755 --- a/process-static +++ b/process-static @@ -5,6 +5,10 @@ shopt -s dotglob extglob globstar export PATH="$PWD/node_modules/.bin:$PATH" +# can use file:// to avoid network requests +[[ -f releases-base ]] && RELEASES_BASE=$(cat releases-base) +RELEASES_BASE=${RELEASES_BASE:-https://releases.grapheneos.org} + rm -rf nginx-tmp cp -a nginx nginx-tmp @@ -24,7 +28,7 @@ find static-tmp -name '*.css' -exec csso {} -o {} \; eslint static-tmp/**/!(fastboot.min.m|z-worker-pako.|pako_inflate.min.|)js find static-tmp -name '*.js' -exec terser --ecma 2021 --module -cmo {} {} \; -replace="" +replace= for file in static-tmp/**/*.css static-tmp/js/*.js static-tmp/mask-icon.svg; do hash=$(sha256sum "$file" | head -c 8) sri_hash=sha256-$(openssl dgst -sha256 -binary "$file" | openssl base64 -A) @@ -40,9 +44,22 @@ for file in static-tmp/**/*.css static-tmp/js/*.js static-tmp/mask-icon.svg; do replace+=";s@{{integrity|/${file#*/}}}@${sri_hash}@g" replace+=";s@{{path|/${file#*/}}}@/${dest#*/}@g" done - sed -i "$replace" static-tmp/**/*.html nginx-tmp/nginx.conf nginx-tmp/snippets/preload.conf +replace= +devices=(raven oriole barbet redfin bramble sunfish coral flame bonito sargo crosshatch blueline) +channels=(stable beta) +for device in ${devices[@]}; do + for channel in ${channels[@]}; do + metadata=$(curl -s $RELEASES_BASE/$device-$channel) + build_id=$(echo -n $metadata | cut -d ' ' -f 3) + build_number=$(echo -n $metadata | cut -d ' ' -f 1) + replace+=";s@{{$device-$channel-BUILD_ID}}@$build_id@g" + replace+=";s@{{$device-$channel-BUILD_NUMBER}}@$build_number@g" + done +done +sed -i "$replace" static-tmp/releases.html + gixy nginx-tmp/nginx.conf xmllint --noout static-tmp/**/*.html diff --git a/static/releases.html b/static/releases.html index c54f13f4..705b59a1 100644 --- a/static/releases.html +++ b/static/releases.html @@ -269,110 +269,110 @@

Pixel 6 Pro

-

Version: SQ1D.220205.004.2022021721

+

Version: {{raven-stable-BUILD_ID}}.{{raven-stable-BUILD_NUMBER}}

Pixel 6

-

Version: SQ1D.220205.004.2022021721

+

Version: {{oriole-stable-BUILD_ID}}.{{oriole-stable-BUILD_NUMBER}}

Pixel 5a

-

Version: SQ1A.220205.002.2022021721

+

Version: {{barbet-stable-BUILD_ID}}.{{barbet-stable-BUILD_NUMBER}}

Pixel 5

-

Version: SQ1A.220205.002.2022021721

+

Version: {{redfin-stable-BUILD_ID}}.{{redfin-stable-BUILD_NUMBER}}

Pixel 4a (5G)

-

Version: SQ1A.220205.002.2022021721

+

Version: {{bramble-stable-BUILD_ID}}.{{bramble-stable-BUILD_NUMBER}}

Pixel 4a

-

Version: SQ1A.220205.002.2022021721

+

Version: {{sunfish-stable-BUILD_ID}}.{{sunfish-stable-BUILD_NUMBER}}

Pixel 4 XL

-

Version: SQ1A.220205.002.2022021721

+

Version: {{coral-stable-BUILD_ID}}.{{coral-stable-BUILD_NUMBER}}

Pixel 4

-

Version: SQ1A.220205.002.2022021721

+

Version: {{flame-stable-BUILD_ID}}.{{flame-stable-BUILD_NUMBER}}

Pixel 3a XL

-

Version: SQ1A.220205.002.2022021721

+

Version: {{bonito-stable-BUILD_ID}}.{{bonito-stable-BUILD_NUMBER}}

Pixel 3a

-

Version: SQ1A.220205.002.2022021721

+

Version: {{sargo-stable-BUILD_ID}}.{{sargo-stable-BUILD_NUMBER}}

Pixel 3 XL (legacy)

-

Version: SP1A.210812.016.C1.2022021721

+

Version: {{crosshatch-stable-BUILD_ID}}.{{crosshatch-stable-BUILD_NUMBER}}

Pixel 3 (legacy)

-

Version: SP1A.210812.016.C1.2022021721

+

Version: {{crosshatch-stable-BUILD_ID}}.{{blueline-stable-BUILD_NUMBER}}

@@ -386,110 +386,110 @@

Pixel 6 Pro

-

Version: SQ1D.220205.004.2022021721

+

Version: {{raven-beta-BUILD_ID}}.{{raven-beta-BUILD_NUMBER}}

Pixel 6

-

Version: SQ1D.220205.004.2022021721

+

Version: {{oriole-beta-BUILD_ID}}.{{oriole-beta-BUILD_NUMBER}}

Pixel 5a

-

Version: SQ1A.220205.002.2022021721

+

Version: {{barbet-beta-BUILD_ID}}.{{barbet-beta-BUILD_NUMBER}}

Pixel 5

-

Version: SQ1A.220205.002.2022021721

+

Version: {{redfin-beta-BUILD_ID}}.{{redfin-beta-BUILD_NUMBER}}

Pixel 4a (5G)

-

Version: SQ1A.220205.002.2022021721

+

Version: {{bramble-beta-BUILD_ID}}.{{bramble-beta-BUILD_NUMBER}}

Pixel 4a

-

Version: SQ1A.220205.002.2022021721

+

Version: {{sunfish-beta-BUILD_ID}}.{{sunfish-beta-BUILD_NUMBER}}

Pixel 4 XL

-

Version: SQ1A.220205.002.2022021721

+

Version: {{coral-beta-BUILD_ID}}.{{coral-beta-BUILD_NUMBER}}

Pixel 4

-

Version: SQ1A.220205.002.2022021721

+

Version: {{flame-beta-BUILD_ID}}.{{flame-beta-BUILD_NUMBER}}

Pixel 3a XL

-

Version: SQ1A.220205.002.2022021721

+

Version: {{bonito-beta-BUILD_ID}}.{{bonito-beta-BUILD_NUMBER}}

Pixel 3a

-

Version: SQ1A.220205.002.2022021721

+

Version: {{sargo-beta-BUILD_ID}}.{{sargo-beta-BUILD_NUMBER}}

Pixel 3 XL (legacy)

-

Version: SP1A.210812.016.C1.2022021721

+

Version: {{crosshatch-beta-BUILD_ID}}.{{crosshatch-beta-BUILD_NUMBER}}

Pixel 3 (legacy)

-

Version: SP1A.210812.016.C1.2022021721

+

Version: {{crosshatch-beta-BUILD_ID}}.{{blueline-beta-BUILD_NUMBER}}