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

Commit cad9560

Browse files
committed
chore(release): create script to undo a release for given number
1 parent b8c5b87 commit cad9560

File tree

4 files changed

+180
-0
lines changed

4 files changed

+180
-0
lines changed

Diff for: scripts/angular.js/untag-release.sh

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
# Untags a release.
4+
5+
echo "###################################"
6+
echo "## Untag angular.js for a release #"
7+
echo "###################################"
8+
9+
ARG_DEFS=(
10+
"--action=(prepare|publish)"
11+
# the version number of the release.
12+
# e.g. 1.2.12 or 1.2.12-rc.1
13+
"--version-number=([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?)"
14+
)
15+
16+
function init {
17+
TMP_DIR=$(resolveDir ../../tmp)
18+
TAG_NAME="v$VERSION_NUMBER"
19+
}
20+
21+
function prepare() {
22+
:
23+
}
24+
25+
function publish() {
26+
# push the tag deletion to github
27+
tags=`git ls-remote --tags [email protected]:angular/angular.js`
28+
if [[ $tags =~ "refs/tags/v$VERSION_NUMBER^" ]]; then
29+
echo "-- Creating dummy git repo for angular.js with origin remote"
30+
mkdir $TMP_DIR/empty-angular.js
31+
cd $TMP_DIR/empty-angular.js
32+
git init
33+
git remote add origin [email protected]:angular/angular.js.git
34+
git push origin ":$TAG_NAME"
35+
else
36+
echo "-- Tag v$VERSION_NUMBER does not exist on remote. Moving on"
37+
fi
38+
}
39+
40+
source $(dirname $0)/../utils.inc

Diff for: scripts/bower/unpublish.sh

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
3+
# Script for removing tags from the Angular bower repos
4+
5+
echo "#################################"
6+
echo "#### Untag bower ################"
7+
echo "#################################"
8+
9+
ARG_DEFS=(
10+
"--action=(prepare|publish)"
11+
"--version-number=([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?)"
12+
)
13+
14+
function init {
15+
TMP_DIR=$(resolveDir ../../tmp)
16+
REPOS=(
17+
angular
18+
angular-animate
19+
angular-cookies
20+
angular-i18n
21+
angular-loader
22+
angular-mocks
23+
angular-route
24+
angular-resource
25+
angular-sanitize
26+
angular-scenario
27+
angular-touch
28+
)
29+
}
30+
31+
function prepare {
32+
:
33+
}
34+
35+
function publish {
36+
for repo in "${REPOS[@]}"
37+
do
38+
tags=`git ls-remote --tags [email protected]:angular/bower-$repo`
39+
if [[ $tags =~ "refs/tags/v$VERSION_NUMBER" ]]; then
40+
echo "-- Creating dummy git repo for bower-$repo with origin remote"
41+
mkdir $TMP_DIR/bower-$repo
42+
cd $TMP_DIR/bower-$repo
43+
git init
44+
git remote add origin [email protected]:angular/bower-$repo.git
45+
git push origin :v$VERSION_NUMBER
46+
echo "-- Deleting v$VERSION_NUMBER tag from bower-$repo"
47+
cd $SCRIPT_DIR
48+
else
49+
echo "-- No remote tag matching v$VERSION_NUMBER exists on bower-$repo"
50+
fi
51+
done
52+
}
53+
54+
source $(dirname $0)/../utils.inc

Diff for: scripts/code.angularjs.org/unpublish.sh

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
# Script for removing specified release dir from code.angularjs.org.
4+
5+
echo "################################################"
6+
echo "## Remove a version from code.angular.js.org ###"
7+
echo "################################################"
8+
9+
ARG_DEFS=(
10+
"--action=(prepare|publish)"
11+
"--version-number=([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?)"
12+
)
13+
14+
function init {
15+
TMP_DIR=$(resolveDir ../../tmp)
16+
REPO_DIR=$TMP_DIR/code.angularjs.org
17+
echo "code tmp $TMP_DIR"
18+
}
19+
20+
function prepare {
21+
echo "-- Cloning code.angularjs.org"
22+
git clone [email protected]:angular/code.angularjs.org.git $REPO_DIR
23+
24+
#
25+
# Remove the files from the repo
26+
#
27+
echo "-- Removing $VERSION_NUMBER from code.angularjs.org"
28+
cd $REPO_DIR
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
36+
}
37+
38+
function publish {
39+
cd $REPO_DIR
40+
41+
echo "-- Pushing code.angularjs.org to github"
42+
git push origin master
43+
}
44+
45+
source $(dirname $0)/../utils.inc

Diff for: scripts/jenkins/undo-release.sh

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
echo "#################################"
4+
echo "#### undo a release ############"
5+
echo "#################################"
6+
7+
ARG_DEFS=(
8+
# require the git dryrun flag so the script can't be run without
9+
# thinking about this!
10+
"--git-push-dryrun=(true|false)"
11+
# the version number of the release.
12+
# e.g. 1.2.12 or 1.2.12-rc.1
13+
"--version-number=([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?)"
14+
)
15+
16+
function init {
17+
if [[ ! $VERBOSE ]]; then
18+
VERBOSE=false
19+
fi
20+
VERBOSE_ARG="--verbose=$VERBOSE"
21+
}
22+
23+
function phase {
24+
ACTION_ARG="--action=$1"
25+
VERSION_NUMBER_ARG="--version-number=$VERSION_NUMBER"
26+
../angular.js/untag-release.sh $ACTION_ARG $VERBOSE_ARG\
27+
--version-number=$VERSION_NUMBER
28+
29+
# ../code.angularjs.org/unpublish.sh $ACTION_ARG $VERSION_NUMBER_ARG $VERBOSE_ARG
30+
../bower/unpublish.sh $ACTION_ARG $VERSION_NUMBER_ARG $VERBOSE_ARG
31+
}
32+
33+
function run {
34+
# First prepare all scripts (build, commit, tag, ...),
35+
# so we are sure everything is all right
36+
phase prepare
37+
# only then publish to github
38+
phase publish
39+
}
40+
41+
source $(dirname $0)/../utils.inc

0 commit comments

Comments
 (0)