Skip to content

Commit 5b13049

Browse files
committed
WIP: more comments, more conditions, more cleanup
1 parent b810088 commit 5b13049

File tree

4 files changed

+42
-53
lines changed

4 files changed

+42
-53
lines changed

scripts/angular.js/untag-release.sh

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,30 @@ ARG_DEFS=(
1313
"--version-number=([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?)"
1414
)
1515

16-
function checkVersionNumber() {
17-
BRANCH_PATTERN=$(readJsonProp "package.json" "branchVersion")
18-
if [[ $VERSION_NUMBER != $BRANCH_PATTERN ]]; then
19-
echo "version-number needs to match $BRANCH_PATTERN on this branch"
20-
usage
21-
fi
22-
}
23-
2416
function init {
25-
cd ../..
26-
checkVersionNumber
17+
TMP_DIR=$(resolveDir ../../tmp)
2718
TAG_NAME="v$VERSION_NUMBER"
2819
}
2920

3021
function prepare() {
31-
#no-op since publish does everything
22+
tags=`git ls-remote --tags git@github.com:angular/angular.js`
23+
if [[ $tags =~ "refs/tags/v$VERSION_NUMBER^" ]]; then
24+
echo "-- Creating dummy git repo for angular.js with origin remote"
25+
mkdir $TMP_DIR/empty-angular.js
26+
cd $TMP_DIR/empty-angular.js
27+
git init
28+
git remote add origin git@github.com:angular/angular.js.git
29+
else
30+
echo "-- Tag v$VERSION_NUMBER does not exist on remote. Moving on"
31+
fi
3232
}
3333

3434
function publish() {
3535
# push the tag deletion to github
36-
git push origin ":$TAG_NAME"
36+
if [ -d "$TMP_DIR/empty-angular.js" ]; then
37+
cd $TMP_DIR/empty-angular.js
38+
git push origin ":$TAG_NAME"
39+
fi
3740
}
3841

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

scripts/bower/unpublish.sh

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ ARG_DEFS=(
1313

1414
function init {
1515
TMP_DIR=$(resolveDir ../../tmp)
16-
BUILD_DIR=$(resolveDir ../../build)
1716
REPOS=(
1817
angular
1918
angular-animate
@@ -30,26 +29,19 @@ function init {
3029
}
3130

3231
function prepare {
33-
#
34-
# clone repos
35-
#
3632
for repo in "${REPOS[@]}"
3733
do
38-
echo "-- Cloning bower-$repo"
39-
git clone git@github.com:angular/bower-$repo.git $TMP_DIR/bower-$repo
40-
done
34+
tags=`git ls-remote --tags git@github.com:angular/bower-$repo`
35+
if [[ $tags =~ "refs/tags/v$VERSION_NUMBER" ]]; then
36+
echo "-- Creating dummy git repo for bower-$repo with origin remote"
37+
mkdir $TMP_DIR/bower-$repo
38+
cd $TMP_DIR/bower-$repo
39+
git init
40+
git remote add origin git@github.com:angular/bower-$repo.git
41+
else
42+
echo "-- No remote tag matching v$VERSION_NUMBER exists on bower-$repo"
43+
fi
4144

42-
#
43-
# update bower.json
44-
# delete tag in each repo
45-
#
46-
for repo in "${REPOS[@]}"
47-
do
48-
echo "-- Creating dummy git repo for bower-$repo with origin remote"
49-
mkdir $TMP_DIR/bower-$repo
50-
cd $TMP_DIR/bower-$repo
51-
git init
52-
git remote add origin git@github.com:angular/bower-$repo.git
5345

5446
cd $SCRIPT_DIR
5547
done
@@ -58,10 +50,14 @@ function prepare {
5850
function publish {
5951
for repo in "${REPOS[@]}"
6052
do
61-
echo "-- Pushing bower-$repo"
62-
cd $TMP_DIR/bower-$repo
63-
git push origin :v$VERSION_NUMBER
64-
cd $SCRIPT_DIR
53+
if [ -d "$TMP_DIR/bower-$repo" ]; then
54+
echo "-- Deleting v$VERSION_NUMBER tag from bower-$repo"
55+
cd $TMP_DIR/bower-$repo
56+
git push origin :v$VERSION_NUMBER
57+
cd $SCRIPT_DIR
58+
else
59+
echo "-- No directory exists for this bower-$repo (presumably because no remote tag)"
60+
fi
6561
done
6662
}
6763

scripts/code.angularjs.org/unpublish.sh

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ ARG_DEFS=(
1313

1414
function init {
1515
TMP_DIR=$(resolveDir ../../tmp)
16-
BUILD_DIR=$(resolveDir ../../build)
1716
REPO_DIR=$TMP_DIR/code.angularjs.org
17+
echo "code tmp $TMP_DIR"
1818
}
1919

2020
function prepare {
@@ -26,26 +26,20 @@ function prepare {
2626
#
2727
echo "-- Removing $VERSION_NUMBER from code.angularjs.org"
2828
cd $REPO_DIR
29-
git rm -r $VERSION_NUMBER
30-
31-
echo "-- Committing removal to code.angularjs.org"
32-
git commit -m "removing v$VERSION_NUMBER"
29+
if [ -d "$VERSION_NUMBER" ]; then
30+
git rm -r $VERSION_NUMBER
31+
echo "-- Committing removal to code.angularjs.org"
32+
git commit -m "removing v$VERSION_NUMBER"
33+
else
34+
echo "-- Version: $VERSION_NUMBER does not exist in code.angularjs.org!"
35+
fi
3336
}
3437

35-
function _update_code() {
38+
function publish {
3639
cd $REPO_DIR
3740

3841
echo "-- Pushing code.angularjs.org to github"
3942
git push origin master
40-
41-
42-
echo "-- Propagating update to server code.angularjs.org"
43-
curl https://code.angularjs.org/gitFetchSite.php
44-
45-
}
46-
47-
function publish {
48-
_update_code
4943
}
5044

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

scripts/jenkins/undo-release.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#!/bin/bash
22

3-
# tags the current commit as a release and publishes all artifacts to
4-
# the different repositories.
5-
# Note: This will also works if the commit is in the past!
6-
73
echo "#################################"
84
echo "#### undo a release ############"
95
echo "#################################"

0 commit comments

Comments
 (0)