ci: compare index.html hash when verifying deploy
This commit is contained in:
@@ -86,11 +86,11 @@ jobs:
|
|||||||
if: steps.guard.outputs.skip != 'true'
|
if: steps.guard.outputs.skip != 'true'
|
||||||
run: |
|
run: |
|
||||||
echo "--- 产物一致性检查 ---"
|
echo "--- 产物一致性检查 ---"
|
||||||
local_index=$(node -p "require('fs').readFileSync('dist/index.html','utf8').match(/index-[A-Za-z0-9_-]+\\.js/)?.[0] || ''")
|
local_sum=$(md5sum dist/index.html | cut -d' ' -f1)
|
||||||
remote_index=$(grep -oE "index-[A-Za-z0-9_-]+\.js" /mnt/nginx-html/gao/index.html | head -1)
|
remote_sum=$(md5sum /mnt/nginx-html/gao/index.html | cut -d' ' -f1)
|
||||||
echo "本地入口:$local_index"
|
echo "本地 index.html:$local_sum"
|
||||||
echo "线上入口:$remote_index"
|
echo "线上 index.html:$remote_sum"
|
||||||
if [ "$local_index" != "$remote_index" ]; then
|
if [ "$local_sum" != "$remote_sum" ]; then
|
||||||
echo "FAIL: 线上 index.html 与本次产物不一致"
|
echo "FAIL: 线上 index.html 与本次产物不一致"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user