Skip to content

Commit b197fd5

Browse files
committed
fixup! Update schema-publish.sh
1 parent eb2a0ad commit b197fd5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

scripts/schema-publish.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ fi
1717
publish_schema() {
1818
local schema="$1"
1919
local date="$2"
20+
local sedCmd="$3"
2021

2122
local base=$(basename $schema '.yaml')
2223
local target=$deploydir/$base/$date
2324

2425
mkdir -p $deploydir/$base
25-
# replace the WORK-IN-PROGRESS placeholder
26-
sed -e "s/${base}\\/WORK-IN-PROGRESS/${base}\\/${date}/g" $schemaDir/$schema > $target.yaml
26+
# replace the WORK-IN-PROGRESS placeholders
27+
sed -e $sedCmd $schemaDir/$schema > $target.yaml
2728

2829
node scripts/yaml2json/yaml2json.js "$target.yaml"
2930
rm "$target.yaml"
@@ -38,6 +39,7 @@ schemas=(meta.yaml dialect.yaml schema.yaml schema-base.yaml)
3839

3940
# publish each schema using its or any of its dependencies newest commit date.
4041
maxDate=""
42+
sedCmds=()
4143
for schema in "${schemas[@]}"; do
4244
if [ -f "$schemaDir/$schema" ]; then
4345
newestCommitDate=$(git log -1 --format="%ad" --date=short "$schemaDir/$schema")
@@ -47,7 +49,11 @@ for schema in "${schemas[@]}"; do
4749
maxDate=$newestCommitDate
4850
fi
4951

50-
publish_schema "$schema" "$maxDate"
52+
base=$(basename $schema '.yaml')
53+
# Add the replacement for this schema's placeholder to list of sed commands.
54+
sedCmds+=("s/${base}\/WORK-IN-PROGRESS/${base}\/${maxDate}/g")
55+
56+
publish_schema "$schema" "$maxDate" $(printf '%s;' "${sedCmds[@]}")
5157
fi
5258
done
5359

0 commit comments

Comments
 (0)