@@ -10,7 +10,8 @@ branch=$(git branch --show-current)
10
10
11
11
if [ -z " $1 " ]; then
12
12
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} "
14
15
else
15
16
echo " Unable to determine version from branch name; should be vX.Y-dev"
16
17
exit 1
@@ -36,7 +37,7 @@ publish_schema() {
36
37
# replace the WORK-IN-PROGRESS placeholders
37
38
sed ${sedCmd[@]} $schemaDir /$schema | npx yaml --json --indent 2 --single > $target
38
39
39
- # Find the jekyll lander markdown file for this iteration .
40
+ # Find the jekyll lander markdown file for this version .
40
41
local jekyllLander=$( find " $deploydir /$base " -maxdepth 1 -name " *.md" )
41
42
42
43
# Move the jekyll lander markdown for this iteration to the deploy destination.
@@ -45,7 +46,19 @@ publish_schema() {
45
46
mv $jekyllLander $target .md
46
47
echo " * $newestCommitDate : $schema & jekyll lander $( basename $jekyllLander ) "
47
48
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
49
62
fi
50
63
51
64
}
0 commit comments