Skip to content

Commit 9d8847e

Browse files
committed
feat(scripts): push generated docs to material assets repo
1 parent d4ab3d3 commit 9d8847e

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

scripts/ci/after-success.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ cd $(dirname $0)/../..
1010
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && $(npm bin)/travis-after-modes; then
1111
echo "All travis modes passed. Publishing the build artifacts..."
1212
./scripts/release/publish-build-artifacts.sh
13-
fi
13+
./scripts/release/publish-docs-artifacts.sh
14+
fi
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# Publish material2 docs assets to the material2-docs-content repo
4+
# material.angular.io will pull from this assets repo to get the latest docs
5+
6+
cd "$(dirname $0)/../../"
7+
8+
docsPath="./dist/docs"
9+
tempRepoPath="./dist/tempRepo"
10+
repoUrl="https://github.com/angular/material2-docs-content"
11+
12+
# If the docs directory is not present, generate docs
13+
if [ ! -d $docsPath ]; then
14+
$(npm bin)/gulp docs
15+
fi
16+
17+
# Get git meta info for commit
18+
commitSha="$(git rev-parse --short HEAD)"
19+
commitAuthorName="$(git --no-pager show -s --format='%an' HEAD)"
20+
commitAuthorEmail="$(git --no-pager show -s --format='%ae' HEAD)"
21+
commitMessage="$(git log --oneline -n 1)"
22+
23+
# create directory and clone test repo
24+
rm -rf $tempRepoPath
25+
mkdir $tempRepoPath
26+
git clone $repoUrl $tempRepoPath
27+
28+
# Clean out repo directory and copy contents of dist/docs into it
29+
rm -rf $tempRepoPath/*
30+
mkdir $tempRepoPath/docs
31+
cp -r $docsPath/* $tempRepoPath/docs
32+
33+
# Push content to repo
34+
cd $tempRepoPath
35+
git config user.name "$commitAuthorName"
36+
git config user.email "$commitAuthorEmail"
37+
git config credential.helper "store --file=.git/credentials"
38+
39+
echo "https://${MATERIAL2_BUILDS_TOKEN}:@github.com" > .git/credentials
40+
41+
git add -A
42+
git commit -m "$commitMessage"
43+
git tag "$commitSha"
44+
git push origin master --tags

0 commit comments

Comments
 (0)