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