2323 shell : bash
2424 run : |
2525 set -euo pipefail
26+ source ".github/scripts/root-manifest-utils.sh"
27+ manifest_path="commerce-apps-manifest/manifest.json"
28+ validate_manifest "$manifest_path"
2629
2730 # Collect changed ZIPs into a file that the next step can reuse
2831 : > changed_zips.txt
@@ -46,22 +49,17 @@ jobs:
4649 continue
4750 fi
4851
49- dir="$(dirname "$zip_path")"
50- manifest_path="$dir/manifest.json"
51-
52- if [[ ! -f "$manifest_path" ]]; then
53- echo "::error file=$manifest_path::manifest.json not found next to ZIP ($zip_path)"
54- exit 1
55- fi
52+ zip_file="$(basename "$zip_path")"
53+ entry="$(get_manifest_entry_for_zip "$zip_file" "$manifest_path")"
5654
5755 # Compute checksum of the ZIP
5856 computed="$(sha256sum "$zip_path" | awk '{print $1}' | tr '[:upper:]' '[:lower:]')"
5957
60- # Read sha256 from manifest.json
61- manifest_sha="$(jq -r '.sha256 // empty' "$manifest_path " | tr '[:upper:]' '[:lower:]')"
58+ # Read sha256 from manifest entry
59+ manifest_sha="$(jq -r '.sha256 // empty' <<< "$entry " | tr '[:upper:]' '[:lower:]')"
6260
6361 if [[ -z "$manifest_sha" || "$manifest_sha" == "null" ]]; then
64- echo "::error file=$manifest_path::Missing or empty \"sha256\" field in manifest.json "
62+ echo "::error file=$manifest_path::Missing or empty \"sha256\" for ZIP $zip_file "
6563 exit 1
6664 fi
6765
@@ -79,42 +77,34 @@ jobs:
7977 shell : bash
8078 run : |
8179 set -euo pipefail
80+ source ".github/scripts/root-manifest-utils.sh"
81+ manifest_path="commerce-apps-manifest/manifest.json"
82+ validate_manifest "$manifest_path"
8283
8384 [[ -s changed_zips.txt ]] || exit 0
8485
8586 while IFS= read -r zip_path; do
8687 [[ -f "$zip_path" ]] || continue
8788
8889 dir="$(dirname "$zip_path")"
89- manifest_path="$dir/manifest.json"
9090 catalog_path="$dir/catalog.json"
9191
9292 if [[ ! -f "$catalog_path" ]]; then
9393 echo "::error file=$catalog_path::catalog.json not found next to ZIP ($zip_path)"
9494 exit 1
9595 fi
9696
97- if [[ ! -f "$manifest_path" ]]; then
98- echo "::error file=$manifest_path::manifest.json not found next to ZIP ($zip_path)"
99- exit 1
100- fi
101-
10297 zip_file="$(basename "$zip_path")"
103- manifest_zip="$(jq -r '.zip // empty' "$manifest_path")"
98+ entry="$(get_manifest_entry_for_zip "$zip_file" "$manifest_path")"
99+ manifest_zip="$(jq -r '.zip // empty' <<< "$entry")"
104100 if [[ -z "$manifest_zip" || "$manifest_zip" == "null" ]]; then
105- echo "::error file=$manifest_path::Missing \"zip\" field in manifest.json "
101+ echo "::error file=$manifest_path::Missing \"zip\" for ZIP $zip_file "
106102 exit 1
107103 fi
108104
109- version="$(jq -r '.version // empty' "$manifest_path ")"
105+ version="$(jq -r '.version // empty' <<< "$entry ")"
110106 if [[ -z "$version" || "$version" == "null" ]]; then
111- echo "::error file=$manifest_path::Missing \"version\" field in manifest.json"
112- exit 1
113- fi
114-
115- # Verify zip field in manifest matches file name
116- if [[ "$manifest_zip" != "$zip_file" ]]; then
117- echo "::error file=$manifest_path::manifest.json \"zip\" ($manifest_zip) does not match changed zip filename ($zip_file)"
107+ echo "::error file=$manifest_path::Missing \"version\" for ZIP $zip_file"
118108 exit 1
119109 fi
120110
@@ -165,10 +155,10 @@ jobs:
165155 fi
166156 done
167157
168- # Ensure app-configuration/taskList .json exists in the ZIP payload
169- required_task_list="$root/app-configuration/taskList .json"
158+ # Ensure app-configuration/tasksList .json exists in the ZIP payload
159+ required_task_list="$root/app-configuration/tasksList .json"
170160 if [[ ! -f "$required_task_list" ]]; then
171- echo "::error file=$zip_path::Missing required file app-configuration/taskList .json"
161+ echo "::error file=$zip_path::Missing required file app-configuration/tasksList .json"
172162 rm -rf "$tmpdir"
173163 exit 1
174164 fi
0 commit comments