Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 3cf2da0

Browse files
committed
chore(publish.sh): publish to all serving backends
1 parent 9335378 commit 3cf2da0

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

scripts/code.angularjs.org/publish.sh

+26-8
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,37 @@ function prepare {
5555
git commit -m "v$NEW_VERSION"
5656
}
5757

58-
function publish {
59-
if [[ $IS_SNAPSHOT_BUILD ]]; then
60-
echo "-- Updating snapshot version"
61-
curl -G --data-urlencode "ver=$NEW_VERSION" http://code.angularjs.org/fetchLatestSnapshot.php
62-
exit 0;
63-
fi
6458

59+
function _update_snapshot() {
60+
for backend in "$@" ; do
61+
echo "-- Updating snapshot version: backend=$backend"
62+
curl -G --data-urlencode "ver=$NEW_VERSION" http://$backend:8003/fetchLatestSnapshot.php
63+
done
64+
}
65+
66+
function _update_code() {
6567
cd $REPO_DIR
68+
6669
echo "-- Pushing code.angularjs.org"
6770
git push origin master
6871

69-
echo "-- Refreshing code.angularjs.org"
70-
curl http://code.angularjs.org/gitFetchSite.php
72+
for backend in "$@" ; do
73+
echo "-- Refreshing code.angularjs.org: backend=$backend"
74+
curl http://$backend:8003/gitFetchSite.php
75+
done
76+
}
77+
78+
function publish {
79+
# The TXT record for backends.angularjs.org is a CSV of the IP addresses for
80+
# the currently serving Compute Engine backends.
81+
# code.angularjs.org is served out of port 8003 on these backends.
82+
backends=("$(dig backends.angularjs.org +short TXT | python -c 'print raw_input()[1:-1].replace(",", "\n")')")
83+
84+
if [[ $IS_SNAPSHOT_BUILD ]]; then
85+
_update_snapshot ${backends[@]}
86+
else
87+
_update_code ${backends[@]}
88+
fi
7189
}
7290

7391
source $(dirname $0)/../utils.inc

0 commit comments

Comments
 (0)