chore(release): create script to undo a release for given number

This commit is contained in:
Jeff Cross
2014-10-02 10:09:45 -07:00
parent b8c5b87119
commit f2942447c1
4 changed files with 180 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
#!/bin/bash
# Untags a release.
echo "###################################"
echo "## Untag angular.js for a release #"
echo "###################################"
ARG_DEFS=(
"--action=(prepare|publish)"
# the version number of the release.
# e.g. 1.2.12 or 1.2.12-rc.1
"--version-number=([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?)"
)
function init {
TMP_DIR=$(resolveDir ../../tmp)
TAG_NAME="v$VERSION_NUMBER"
}
function prepare() {
:
}
function publish() {
# push the tag deletion to github
tags=`git ls-remote --tags git@github.com:angular/angular.js`
if [[ $tags =~ "refs/tags/v$VERSION_NUMBER^" ]]; then
echo "-- Creating dummy git repo for angular.js with origin remote"
mkdir $TMP_DIR/empty-angular.js
cd $TMP_DIR/empty-angular.js
git init
git remote add origin git@github.com:angular/angular.js.git
git push origin ":$TAG_NAME"
else
echo "-- Tag v$VERSION_NUMBER does not exist on remote. Moving on"
fi
}
source $(dirname $0)/../utils.inc

54
scripts/bower/unpublish.sh Executable file
View File

@@ -0,0 +1,54 @@
#!/bin/bash
# Script for removing tags from the Angular bower repos
echo "#################################"
echo "#### Untag bower ################"
echo "#################################"
ARG_DEFS=(
"--action=(prepare|publish)"
"--version-number=([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?)"
)
function init {
TMP_DIR=$(resolveDir ../../tmp)
REPOS=(
angular
angular-animate
angular-cookies
angular-i18n
angular-loader
angular-mocks
angular-route
angular-resource
angular-sanitize
angular-scenario
angular-touch
)
}
function prepare {
:
}
function publish {
for repo in "${REPOS[@]}"
do
tags=`git ls-remote --tags git@github.com:angular/bower-$repo`
if [[ $tags =~ "refs/tags/v$VERSION_NUMBER" ]]; then
echo "-- Creating dummy git repo for bower-$repo with origin remote"
mkdir $TMP_DIR/bower-$repo
cd $TMP_DIR/bower-$repo
git init
git remote add origin git@github.com:angular/bower-$repo.git
git push origin :v$VERSION_NUMBER
echo "-- Deleting v$VERSION_NUMBER tag from bower-$repo"
cd $SCRIPT_DIR
else
echo "-- No remote tag matching v$VERSION_NUMBER exists on bower-$repo"
fi
done
}
source $(dirname $0)/../utils.inc

View File

@@ -0,0 +1,45 @@
#!/bin/bash
# Script for removing specified release dir from code.angularjs.org.
echo "################################################"
echo "## Remove a version from code.angular.js.org ###"
echo "################################################"
ARG_DEFS=(
"--action=(prepare|publish)"
"--version-number=([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?)"
)
function init {
TMP_DIR=$(resolveDir ../../tmp)
REPO_DIR=$TMP_DIR/code.angularjs.org
echo "code tmp $TMP_DIR"
}
function prepare {
echo "-- Cloning code.angularjs.org"
git clone git@github.com:angular/code.angularjs.org.git $REPO_DIR
#
# Remove the files from the repo
#
echo "-- Removing $VERSION_NUMBER from code.angularjs.org"
cd $REPO_DIR
if [ -d "$VERSION_NUMBER" ]; then
git rm -r $VERSION_NUMBER
echo "-- Committing removal to code.angularjs.org"
git commit -m "removing v$VERSION_NUMBER"
else
echo "-- Version: $VERSION_NUMBER does not exist in code.angularjs.org!"
fi
}
function publish {
cd $REPO_DIR
echo "-- Pushing code.angularjs.org to github"
git push origin master
}
source $(dirname $0)/../utils.inc

41
scripts/jenkins/undo-release.sh Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/bash
echo "#################################"
echo "#### undo a release ############"
echo "#################################"
ARG_DEFS=(
# require the git dryrun flag so the script can't be run without
# thinking about this!
"--git-push-dryrun=(true|false)"
# the version number of the release.
# e.g. 1.2.12 or 1.2.12-rc.1
"--version-number=([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?)"
)
function init {
if [[ ! $VERBOSE ]]; then
VERBOSE=false
fi
VERBOSE_ARG="--verbose=$VERBOSE"
}
function phase {
ACTION_ARG="--action=$1"
VERSION_NUMBER_ARG="--version-number=$VERSION_NUMBER"
../angular.js/untag-release.sh $ACTION_ARG $VERBOSE_ARG\
--version-number=$VERSION_NUMBER
../code.angularjs.org/unpublish.sh $ACTION_ARG $VERSION_NUMBER_ARG $VERBOSE_ARG
../bower/unpublish.sh $ACTION_ARG $VERSION_NUMBER_ARG $VERBOSE_ARG
}
function run {
# First prepare all scripts (build, commit, tag, ...),
# so we are sure everything is all right
phase prepare
# only then publish to github
phase publish
}
source $(dirname $0)/../utils.inc