Verify deployed build metadata
This commit is contained in:
@@ -171,9 +171,12 @@ jobs:
|
||||
alpine:latest \
|
||||
sh -lc '
|
||||
test -d /app/frontend
|
||||
mkdir -p /app/frontend/public
|
||||
printf "VITE_BUILD_VERSION=%s\nVITE_BUILD_DATE=%s\n" "$BUILD_VERSION" "$BUILD_DATE" > /app/frontend/.env.production
|
||||
printf "{\n \"version\": \"%s\",\n \"buildDate\": \"%s\"\n}\n" "$BUILD_VERSION" "$BUILD_DATE" > /app/frontend/public/build-meta.json
|
||||
echo "Frontend build metadata:"
|
||||
cat /app/frontend/.env.production
|
||||
cat /app/frontend/public/build-meta.json
|
||||
'
|
||||
|
||||
- name: Prepare deploy host disk headroom
|
||||
@@ -308,9 +311,11 @@ jobs:
|
||||
css_asset="$(printf "%s" "$index" | grep -Eo '/assets/index-[^"]+\.css' | head -n 1)"
|
||||
test -n "$js_asset"
|
||||
test -n "$css_asset"
|
||||
js_body="$(curl -fsS --max-time 20 "${LIVE_URL}${js_asset}")"
|
||||
printf "%s" "$js_body" | grep -Fq "${{ steps.meta.outputs.build_version }}"
|
||||
curl -fsS --max-time 20 "${LIVE_URL}${js_asset}" >/dev/null
|
||||
curl -fsS --max-time 20 "${LIVE_URL}${css_asset}" >/dev/null
|
||||
meta_body="$(curl -fsS --max-time 15 "${LIVE_URL}/build-meta.json")"
|
||||
echo "$meta_body"
|
||||
echo "$meta_body" | grep -Fq '"version": "${{ steps.meta.outputs.build_version }}"'
|
||||
echo "Frontend assets served: ${js_asset}, ${css_asset}"
|
||||
echo "Frontend version verified: ${{ steps.meta.outputs.build_version }}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user