Skip to content

Commit 009f211

Browse files
devversionmmalerba
authored andcommitted
build: fix docs-content branch publish (#12690)
Currently the docs-content output will be overwritten each time a Travis job runs in another branch (e.g. `master`, `6.4.x`, `6.x`). This is because the given branches cannot be created in the `material2-docs-content´ repository. This is not good because if we want to release a new patch version, we have no way to properly pull the docs-content data that matches the given new version. Meaning that the docs-content and the `@angular/material-examples` package might be already updated for the next `major` version and we run into runtime exceptions due to the breaking changes.
1 parent 13c141e commit 009f211

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

scripts/deploy/publish-docs-content.sh

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,24 @@ echo "Starting deployment of the docs-content for ${buildVersionName} in ${branc
5656
# Remove the docs-content repository if the directory exists
5757
rm -Rf ${docsContentPath}
5858

59-
# Clone the docs-content repository.
60-
git clone ${docsContentRepoUrl} ${docsContentPath} --depth 1
59+
echo "Starting cloning process of ${docsContentRepoUrl} into ${docsContentPath}.."
6160

62-
echo "Successfully cloned docs-content repository."
61+
if [[ $(git ls-remote --heads ${docsContentRepoUrl} ${branchName}) ]]; then
62+
echo "Branch ${branchName} already exists. Cloning that branch."
63+
git clone ${docsContentRepoUrl} ${docsContentPath} --depth 1 --branch ${branchName}
6364

64-
# Go into the repository directory.
65-
cd ${docsContentPath}
65+
cd ${docsContentPath}
66+
echo "Cloned repository and switched into the repository directory (${docsContentPath})."
67+
else
68+
echo "Branch ${branchName} does not exist yet."
69+
echo "Cloning default branch and creating branch '${branchName}' on top of it."
6670

67-
echo "Switched into the repository directory."
71+
git clone ${docsContentRepoUrl} ${docsContentPath} --depth 1
72+
cd ${docsContentPath}
73+
74+
echo "Cloned repository and switched into directory. Creating new branch now.."
6875

69-
if [[ $(git ls-remote --heads origin ${branchName}) ]]; then
70-
git checkout ${branchName}
71-
echo "Switched to ${branchName} branch."
72-
else
73-
echo "Branch ${branchName} does not exist on the docs-content repo yet. Creating ${branchName}.."
7476
git checkout -b ${branchName}
75-
echo "Branch created and checked out."
7677
fi
7778

7879
# Remove everything inside of the docs-content repository.
@@ -123,6 +124,6 @@ echo "Credentials for docs-content repository are now set up. Publishing.."
123124
git add -A
124125
git commit --allow-empty -m "${buildCommitMessage}"
125126
git tag "${buildTagName}"
126-
git push origin master --tags
127+
git push origin ${branchName} --tags
127128

128129
echo "Published docs-content for ${buildVersionName} into ${branchName} successfully"

0 commit comments

Comments
 (0)