Skip to content

Commit b1d676b

Browse files
committed
chore(build): check cdn before executing the release-after-cdn script
1 parent 9ddef84 commit b1d676b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

scripts/jenkins/release-after-cdn.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,9 @@ ARG_DEFS=(
44
# require the git dryrun flag so the script can't be run without
55
# thinking about this!
66
"--git-push-dryrun=(true|false)"
7+
"--cdn-version=(.*)"
78
)
89

9-
function findLatestRelease {
10-
# returns e.g. v1.2.7
11-
LATEST_TAG=$(git describe --abbrev=0 --tags)
12-
# returns e.g. 1.2.7
13-
echo ${LATEST_TAG:1}
14-
}
15-
1610
function init {
1711
NG_ARGS=("$@")
1812
if [[ ! $VERBOSE ]]; then
@@ -23,14 +17,22 @@ function init {
2317

2418
function phase {
2519
ACTION_ARG="--action=$1"
26-
CDN_VERSION_ARG="--cdn-version=$LATEST_VERSION"
20+
CDN_VERSION_ARG="--cdn-version=$CDN_VERSION"
2721
./scripts/angular.js/publish-cdn-version.sh $ACTION_ARG $CDN_VERSION_ARG $VERBOSE_ARG
2822
./scripts/angularjs.org/publish.sh $ACTION_ARG $CDN_VERSION_ARG $VERBOSE_ARG
2923
}
3024

25+
function checkCdn {
26+
STATUS=$(curl http://ajax.googleapis.com/ajax/libs/angularjs/$CDN_VERSION/angular.min.js --write-out '%{http_code}' -o /dev/null -silent)
27+
if [[ $STATUS != 200 ]]; then
28+
echo "Could not find release $CDN_VERSION on CDN"
29+
exit 1
30+
fi
31+
}
32+
3133
function run {
3234
cd ../..
33-
LATEST_VERSION=$(findLatestRelease)
35+
checkCdn
3436

3537
phase prepare
3638
phase publish

0 commit comments

Comments
 (0)