|
75 | 75 | fi |
76 | 76 | done < changed_zips.txt |
77 | 77 |
|
78 | | - - name: Step 2 - Unzip and verify top level folder structure |
| 78 | + - name: Step 2 - Verify manifest zip name matches + version is new vs catalog.json |
| 79 | + shell: bash |
| 80 | + run: | |
| 81 | + set -euo pipefail |
| 82 | +
|
| 83 | + [[ -s changed_zips.txt ]] || exit 0 |
| 84 | +
|
| 85 | + while IFS= read -r zip_path; do |
| 86 | + [[ -f "$zip_path" ]] || continue |
| 87 | +
|
| 88 | + dir="$(dirname "$zip_path")" |
| 89 | + manifest_path="$dir/manifest.json" |
| 90 | + catalog_path="$dir/catalog.json" |
| 91 | +
|
| 92 | + if [[ ! -f "$catalog_path" ]]; then |
| 93 | + echo "::error file=$catalog_path::catalog.json not found next to ZIP ($zip_path)" |
| 94 | + exit 1 |
| 95 | + fi |
| 96 | +
|
| 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 | +
|
| 102 | + zip_file="$(basename "$zip_path")" |
| 103 | + manifest_zip="$(jq -r '.zip // empty' "$manifest_path")" |
| 104 | + if [[ -z "$manifest_zip" || "$manifest_zip" == "null" ]]; then |
| 105 | + echo "::error file=$manifest_path::Missing \"zip\" field in manifest.json" |
| 106 | + exit 1 |
| 107 | + fi |
| 108 | +
|
| 109 | + version="$(jq -r '.version // empty' "$manifest_path")" |
| 110 | + 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)" |
| 118 | + exit 1 |
| 119 | + fi |
| 120 | +
|
| 121 | + # Verify new version in manifest is unique |
| 122 | + if jq -e --arg v "$version" '.versions[]? | select(.version == $v)' "$catalog_path" >/dev/null; then |
| 123 | + echo "::error file=$catalog_path::Version $version already exists in catalog.json" |
| 124 | + exit 1 |
| 125 | + fi |
| 126 | + done < changed_zips.txt |
| 127 | +
|
| 128 | + - name: Step 3 - Unzip and verify top level folder structure |
79 | 129 | shell: bash |
80 | 130 | run: | |
81 | 131 | set -euo pipefail |
@@ -117,7 +167,7 @@ jobs: |
117 | 167 | rm -rf "$tmpdir" |
118 | 168 | done < changed_zips.txt |
119 | 169 | |
120 | | - - name: Step 3 - [Tax] Verify hooks exist and scripts resolve |
| 170 | + - name: Step 4 - [Tax] Verify hooks exist and scripts resolve |
121 | 171 | shell: bash |
122 | 172 | run: | |
123 | 173 | set -euo pipefail |
|
0 commit comments