@@ -10,7 +10,8 @@ branch=$(git branch --show-current)
1010
1111if [ -z " $1 " ]; then
1212 if [[ $branch =~ ^v([0-9]+\. [0-9]+)-dev$ ]]; then
13- deploydir=" ./deploy/oas/${BASH_REMATCH[1]} "
13+ version=" ${BASH_REMATCH[1]} "
14+ deploydir=" ./deploy/oas/${version} "
1415 else
1516 echo " Unable to determine version from branch name; should be vX.Y-dev"
1617 exit 1
@@ -36,7 +37,7 @@ publish_schema() {
3637 # replace the WORK-IN-PROGRESS placeholders
3738 sed ${sedCmd[@]} $schemaDir /$schema | npx yaml --json --indent 2 --single > $target
3839
39- # Find the jekyll lander markdown file for this iteration .
40+ # Find the jekyll lander markdown file for this version .
4041 local jekyllLander=$( find " $deploydir /$base " -maxdepth 1 -name " *.md" )
4142
4243 # Move the jekyll lander markdown for this iteration to the deploy destination.
@@ -45,7 +46,19 @@ publish_schema() {
4546 mv $jekyllLander $target .md
4647 echo " * $newestCommitDate : $schema & jekyll lander $( basename $jekyllLander ) "
4748 else
48- echo " * $newestCommitDate : $schema "
49+ # Find the most recent preceding version.
50+ local lastdir=" " ; for fn in $( dirname $deploydir ) /? .? ; do test " $fn " " <" " $deploydir " && lastdir=" $fn " ; done
51+ local lastVersion=$( basename $lastdir )
52+ # Find the jekyll lander markdown file for the preceding version.
53+ local lastLander=$( find " $lastdir /$base " -maxdepth 1 -name " *.md" )
54+
55+ if [ ! -z " $lastLander " ]; then
56+ # copy and adjust the lander file from the preceding version
57+ sed " s/$lastVersion /$version /g" $lastLander > $target .md
58+ echo " * $newestCommitDate : $schema & jekyll lander $( basename $lastLander ) of $lastVersion "
59+ else
60+ echo " * $newestCommitDate : $schema "
61+ fi
4962 fi
5063
5164}
0 commit comments