2015-05-13 14:43:46 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
ARG_DEFS=(
|
|
|
|
|
"--version=(.*)"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
function run {
|
|
|
|
|
cd ../
|
|
|
|
|
|
|
|
|
|
echo "-- Building docs site release..."
|
|
|
|
|
rm -rf dist
|
|
|
|
|
gulp docs --release
|
|
|
|
|
|
|
|
|
|
echo "-- Cloning code.material.angularjs.org..."
|
|
|
|
|
rm -rf code.material.angularjs.org
|
2017-06-14 17:56:35 -05:00
|
|
|
git clone https://github.com/angular/code.material.angularjs.org --depth=1
|
2015-05-13 14:43:46 -07:00
|
|
|
|
|
|
|
|
echo "-- Remove previous snapshot..."
|
|
|
|
|
rm -rf code.material.angularjs.org/HEAD
|
|
|
|
|
|
|
|
|
|
echo "-- Copying docs site to snapshot..."
|
2016-02-04 14:09:14 -06:00
|
|
|
sed -i "s,http://localhost:8080/angular-material,https://cdn.gitcdn.link/cdn/angular/bower-material/v$VERSION/angular-material,g" dist/docs/docs.js
|
2015-12-17 11:40:40 -06:00
|
|
|
sed -i "s,http://localhost:8080/docs.css,https://material.angularjs.org/$VERSION/docs.css,g" dist/docs/docs.js
|
2015-09-30 12:04:53 -07:00
|
|
|
sed -i "s,base href=\",base href=\"/HEAD,g" dist/docs/index.html
|
2015-06-22 11:01:14 -05:00
|
|
|
|
2015-05-13 14:43:46 -07:00
|
|
|
cp -Rf dist/docs code.material.angularjs.org/HEAD
|
|
|
|
|
|
2017-06-14 17:56:35 -05:00
|
|
|
commitAuthorName=$(git --no-pager show -s --format='%an' HEAD)
|
|
|
|
|
commitAuthorEmail=$(git --no-pager show -s --format='%ae' HEAD)
|
|
|
|
|
|
2015-05-13 14:43:46 -07:00
|
|
|
cd code.material.angularjs.org
|
2017-06-13 18:23:10 -05:00
|
|
|
|
2017-06-14 17:56:35 -05:00
|
|
|
# GitHub token specified as Travis environment variable
|
|
|
|
|
git config user.name "${commitAuthorName}"
|
|
|
|
|
git config user.email "${commitAuthorEmail}"
|
|
|
|
|
git config credential.helper "store --file=.git/credentials"
|
|
|
|
|
echo "https://${ANGULARJS_MATERIAL_DOCS_SITE_TOKEN}:@github.com" > .git/credentials
|
|
|
|
|
|
2015-05-13 14:43:46 -07:00
|
|
|
echo "-- Commiting snapshot..."
|
|
|
|
|
git add -A
|
|
|
|
|
git commit -m "snapshot: $VERSION"
|
|
|
|
|
|
|
|
|
|
echo "-- Pushing snapshot..."
|
|
|
|
|
git push -q origin master
|
|
|
|
|
|
|
|
|
|
cd ../
|
|
|
|
|
|
|
|
|
|
echo "-- Cleanup..."
|
|
|
|
|
rm -rf code.material.angularjs.org
|
|
|
|
|
|
|
|
|
|
echo "-- Successfully pushed the snapshot to angular/code.material.angularjs.org!!"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
source $(dirname $0)/utils.inc
|