Skip to content

Commit fd8c379

Browse files
riavalontinayuangao
authored andcommitted
chore: add examples folder into pushing script (#3035)
1 parent 597e3de commit fd8c379

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

scripts/release/publish-docs-content.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ cd "$(dirname $0)/../../"
88
docsPath="/dist/docs"
99
repoPath="/tmp/material2-docs-content"
1010
repoUrl="https://github.com/DevVersion/material2-docs-content"
11+
examplesSource="/dist/docs/examples"
1112

1213
# If the docs directory is not present, generate docs
1314
if [ ! -d $docsPath ]; then
@@ -21,47 +22,46 @@ commitAuthorEmail="$(git --no-pager show -s --format='%ae' HEAD)"
2122
commitMessage="$(git log --oneline -n 1)"
2223

2324
# create directory and clone test repo
24-
rm -rf "/tmp/"
25-
mkdir "/tmp/" $repoPath
25+
rm -rf /tmp/
26+
mkdir -p $repoPath
2627
git clone $repoUrl $repoPath
2728

2829
# Clean out repo directory and copy contents of dist/docs into it
2930
rm -rf $repoPath/*
3031
mkdir $repoPath/overview
3132
mkdir $repoPath/guides
3233
mkdir $repoPath/api
33-
# mkdir $repoPath/examples
34+
mkdir $repoPath/examples
3435

3536
# Move api files over to $repoPath/api
3637
cp -r $docsPath/api/* $repoPath/api
3738

38-
# Move guide files over to $repoPath/guides
39-
for filename in $overviewFiles*
40-
do
41-
if [ -f $filename ]; then
42-
cp -r $filename $repoPath/guides
43-
fi
44-
done
45-
4639
# Flatten the markdown docs structure and move it into $repoPath/overview
4740
overviewFiles=$docsPath/markdown/
48-
targetFile="OVERVIEW.html"
4941
for filename in $overviewFiles*
5042
do
5143
if [ -d $filename ]; then
5244
for _ in $filename/*
5345
do
54-
if [ -f $filename/$targetFile ]; then
55-
name=${filename#$overviewFiles}
56-
cp -r $filename/$targetFile $repoPath/overview/
57-
mv $repoPath/overview/$targetFile $repoPath/overview/$name.html
46+
markdownFile=${filename#$overviewFiles}.html
47+
# Filename should be same as folder name with .html extension
48+
if [ -e $filename/$markdownFile ]; then
49+
cp -r $filename/$markdownFile $repoPath/overview/
5850
fi
5951
done
6052
fi
6153
done
6254

63-
# src/examples should be added to the $repoPath after they have been moved into
64-
# the material2 repo from material.angular.io
55+
# Move guide files over to $repoPath/guides
56+
for filename in $overviewFiles*
57+
do
58+
if [ -f $filename ]; then
59+
cp -r $filename $repoPath/guides
60+
fi
61+
done
62+
63+
# Move highlighted examples into $repoPath
64+
cp -r $examplesSource/* $repoPath/examples
6565

6666
# Push content to repo
6767
cd $repoPath

0 commit comments

Comments
 (0)