Skip to content

Commit f101822

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

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
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

scripts/ci/sources/mode.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ is_aot() {
1515

1616
is_payload() {
1717
[[ "$MODE" = payload ]]
18-
}
18+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
root="$(pwd)"
8+
9+
docsPath="./dist/docs"
10+
tempRepoPath="./dist/tempRepo"
11+
repoUrl="https://github.com/angular/material2-docs-content"
12+
13+
# If the docs directory is not present, generate docs
14+
if [ ! -d $docsPath ]; then
15+
$(npm bin)/gulp docs
16+
fi
17+
18+
# Get git meta info for commit
19+
commitSha="$(git rev-parse --short HEAD)"
20+
commitAuthorName="$(git --no-pager show -s --format='%an' HEAD)"
21+
commitAuthorEmail="$(git --no-pager show -s --format='%ae' HEAD)"
22+
commitMessage="$(git log --oneline -n 1)"
23+
24+
# create directory and clone test repo
25+
rm -rf $tempRepoPath
26+
mkdir $tempRepoPath
27+
git clone $repoUrl $tempRepoPath
28+
29+
# Clean out repo directory and copy contents of dist/docs into it
30+
rm -rf $tempRepoPath/*
31+
mkdir $tempRepoPath/docs
32+
cp -r $docsPath/* $tempRepoPath/docs
33+
34+
# Push content to repo
35+
cd $tempRepoPath
36+
git config user.name "$commitAuthorName"
37+
git config user.email "$commitAuthorEmail"
38+
git config credential.helper "store --file=.git/credentials"
39+
40+
echo "https://${MATERIAL2_BUILDS_TOKEN}:@github.com" > .git/credentials
41+
42+
git add -A
43+
git commit -m "$commitMessage"
44+
git tag "$commitSha"
45+
git push origin master --tags
46+
47+
rm -rf $root/dist/tempRepo

0 commit comments

Comments
 (0)