-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(scripts): push generated docs to material assets repo
- Loading branch information
Showing
3 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,4 @@ is_aot() { | |
|
||
is_payload() { | ||
[[ "$MODE" = payload ]] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
# Publish material2 docs assets to the material2-docs-content repo | ||
# material.angular.io will pull from this assets repo to get the latest docs | ||
|
||
cd "$(dirname $0)/../../" | ||
root="$(pwd)" | ||
|
||
docsPath="./dist/docs" | ||
tempRepoPath="./dist/tempRepo" | ||
repoUrl="https://github.com/angular/material2-docs-content" | ||
|
||
# If the docs directory is not present, generate docs | ||
if [ ! -d $docsPath ]; then | ||
$(npm bin)/gulp docs | ||
fi | ||
|
||
# Get git meta info for commit | ||
commitSha="$(git rev-parse --short HEAD)" | ||
commitAuthorName="$(git --no-pager show -s --format='%an' HEAD)" | ||
commitAuthorEmail="$(git --no-pager show -s --format='%ae' HEAD)" | ||
commitMessage="$(git log --oneline -n 1)" | ||
|
||
# create directory and clone test repo | ||
rm -rf $tempRepoPath | ||
mkdir $tempRepoPath | ||
git clone $repoUrl $tempRepoPath | ||
|
||
# Clean out repo directory and copy contents of dist/docs into it | ||
rm -rf $tempRepoPath/* | ||
mkdir $tempRepoPath/docs | ||
cp -r $docsPath/* $tempRepoPath/docs | ||
|
||
# Push content to repo | ||
cd $tempRepoPath | ||
git config user.name "$commitAuthorName" | ||
git config user.email "$commitAuthorEmail" | ||
git config credential.helper "store --file=.git/credentials" | ||
|
||
echo "https://${MATERIAL2_BUILDS_TOKEN}:@github.com" > .git/credentials | ||
|
||
git add -A | ||
git commit -m "$commitMessage" | ||
git tag "$commitSha" | ||
git push origin master --tags | ||
|
||
rm -rf $root/dist/tempRepo |