2013-12-13 12:49:42 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2014-01-06 12:19:51 -08:00
|
|
|
# Script for updating code.angularjs.org repo from current local build.
|
|
|
|
|
|
2013-12-13 20:02:15 -08:00
|
|
|
echo "#################################"
|
2014-10-01 20:56:17 -04:00
|
|
|
echo "## Update code.angularjs.org ###"
|
2013-12-13 20:02:15 -08:00
|
|
|
echo "#################################"
|
2013-12-13 12:49:42 -08:00
|
|
|
|
2014-01-06 12:19:51 -08:00
|
|
|
ARG_DEFS=(
|
|
|
|
|
"--action=(prepare|publish)"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
function init {
|
|
|
|
|
TMP_DIR=$(resolveDir ../../tmp)
|
|
|
|
|
BUILD_DIR=$(resolveDir ../../build)
|
|
|
|
|
REPO_DIR=$TMP_DIR/code.angularjs.org
|
|
|
|
|
NEW_VERSION=$(cat $BUILD_DIR/version.txt)
|
|
|
|
|
if [[ "$NEW_VERSION" =~ sha ]]; then
|
|
|
|
|
IS_SNAPSHOT_BUILD=true
|
|
|
|
|
else
|
|
|
|
|
IS_SNAPSHOT_BUILD=
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function prepare {
|
|
|
|
|
|
|
|
|
|
echo "-- Cloning code.angularjs.org"
|
2019-02-04 13:31:07 +00:00
|
|
|
git clone https://github.com/angular/code.angularjs.org $REPO_DIR --depth=1
|
2014-01-06 12:19:51 -08:00
|
|
|
|
|
|
|
|
echo "-- Updating code.angularjs.org"
|
2015-02-25 11:01:29 +00:00
|
|
|
|
|
|
|
|
if [[ $IS_SNAPSHOT_BUILD ]]; then
|
|
|
|
|
#
|
|
|
|
|
# update the snapshot folder
|
|
|
|
|
#
|
|
|
|
|
rm -rf $REPO_DIR/snapshot
|
|
|
|
|
mkdir $REPO_DIR/snapshot
|
|
|
|
|
cp -r $BUILD_DIR/* $REPO_DIR/snapshot/
|
|
|
|
|
else
|
|
|
|
|
#
|
|
|
|
|
# copy the files from the build
|
|
|
|
|
#
|
|
|
|
|
mkdir $REPO_DIR/$NEW_VERSION
|
|
|
|
|
cp -r $BUILD_DIR/* $REPO_DIR/$NEW_VERSION/
|
|
|
|
|
fi
|
2014-01-06 12:19:51 -08:00
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# commit
|
|
|
|
|
#
|
|
|
|
|
echo "-- Committing code.angularjs.org"
|
|
|
|
|
cd $REPO_DIR
|
|
|
|
|
git add -A
|
|
|
|
|
git commit -m "v$NEW_VERSION"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-03-05 11:20:38 -08:00
|
|
|
function _update_code() {
|
2014-01-06 12:19:51 -08:00
|
|
|
cd $REPO_DIR
|
2014-03-05 11:20:38 -08:00
|
|
|
|
2014-01-06 12:19:51 -08:00
|
|
|
echo "-- Pushing code.angularjs.org"
|
|
|
|
|
git push origin master
|
2014-03-05 11:20:38 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function publish {
|
2017-07-13 11:14:55 +02:00
|
|
|
# publish updates the code.angularjs.org Github repository
|
2020-05-21 09:13:46 +01:00
|
|
|
# the deployment to Firebase happens via CI
|
2017-07-13 11:14:55 +02:00
|
|
|
_update_code
|
2014-01-06 12:19:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
source $(dirname $0)/../utils.inc
|