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

Commit

Permalink
chore(release): create script to undo a release for given number
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffbcross committed Oct 2, 2014
1 parent b8c5b87 commit cad9560
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 0 deletions.
40 changes: 40 additions & 0 deletions scripts/angular.js/untag-release.sh
Original file line number Diff line number Diff line change
@@ -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 [email protected]: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 [email protected]: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 changes: 54 additions & 0 deletions scripts/bower/unpublish.sh
Original file line number Diff line number Diff line change
@@ -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 [email protected]: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 [email protected]: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
45 changes: 45 additions & 0 deletions scripts/code.angularjs.org/unpublish.sh
Original file line number Diff line number Diff line change
@@ -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 [email protected]: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 changes: 41 additions & 0 deletions scripts/jenkins/undo-release.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cad9560

Please sign in to comment.