11#! /bin/bash
22
3- #
4- # update all the things
5- #
6-
7- set -e # fail if any command fails
3+ echo " #################################"
4+ echo " ## Update code.angular.js.org ###"
5+ echo " #################################"
86
7+ # Enable tracing and exit on first failure
8+ set -xe
9+ # Normalize working dir to script dir
910cd ` dirname $0 `
10- SCRIPT_DIR=` pwd`
1111
12+
13+ # export so that node.js can read those env settings
1214export TMP_DIR=../../tmp
1315export REPO_DIR=$TMP_DIR /code.angularjs.org
14-
1516export BUILD_DIR=../../build
1617
17- NEW_VERSION=$( node -e " console.log(require(process.env.BUILD_DIR+'/version.json').full)" | sed -e ' s/\r//g' )
18+ SCRIPT_DIR=` pwd`
19+ NEW_VERSION=` cat $BUILD_DIR /version.txt`
1820
1921#
20- # Don't publish snapshot builds!
22+ # Snapshot builds are kept in a temp directory in code.angularjs.org
23+ # that is filled by calling a php script there.
2124#
2225if [[ " $NEW_VERSION " =~ sha ]] ; then
23- echo " publish to code.angularjs.org is not allowed for snapshot builds"
24- exit 1;
26+ echo " -- updating snapshot version"
27+ curl -G --data-urlencode " ver=$NEW_VERSION " http://code.angularjs.org/fetchLatestSnapshot.php
28+ exit 0;
2529fi
2630
27- exit 2
28-
2931#
3032# clone
3133#
3234
35+ echo " -- Cloning code.angularjs.org"
3336git clone git@github.com:angular/code.angularjs.org.git $REPO_DIR
3437
3538#
3639# copy the files from the build
3740#
3841
42+ echo " -- Updating code.angularjs.org"
3943mkdir $REPO_DIR /$NEW_VERSION
40-
4144cd $REPO_DIR
4245git reset --hard HEAD
4346git checkout master
@@ -49,9 +52,14 @@ cp -r $BUILD_DIR/* $REPO_DIR/$NEW_VERSION/
4952#
5053# commit and push
5154#
52-
55+ echo " -- Committing and pushing code.angularjs.org "
5356cd $REPO_DIR
5457git add -A
5558git commit -m " v$NEW_VERSION "
56- # TODO git push origin master
59+ git push origin master
5760cd $SCRIPT_DIR
61+
62+ #
63+ # refresh code.angularjs.org from github
64+ #
65+ curl http://code.angularjs.org/gitFetchSite.php
0 commit comments