forked from jboss-developer/jboss-migration-center
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
299 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
#!/usr/bin/env bash | ||
|
||
SOURCE="${BASH_SOURCE[0]}" | ||
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done | ||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" | ||
|
||
# Define | ||
|
||
# team email subject | ||
EMAIL_SUBJECT="Migration Center released at \${PRODUCTION_URL}" | ||
# EAP team email To ? | ||
EMAIL_TO="[email protected]" | ||
EMAIL_FROM="\"Migration Center Publish Script\" <[email protected]>" | ||
|
||
JBORG_DIR="migration" | ||
JBORG_REPO="filemgmt.jboss.org:www_htdocs" | ||
|
||
STAGING_URL="${JBORG_DIR}.jboss.org/staging" | ||
STAGING_DIR="${JBORG_DIR}/staging" | ||
|
||
PRODUCTION_DIR="${JBORG_DIR}" | ||
PRODUCTION_URL="${PRODUCTION_DIR}.jboss.org/" | ||
|
||
|
||
notify_email() | ||
{ | ||
echo "***** Performing Migration Center release notifications" | ||
echo "*** Notifying jboss-migration list" | ||
subject=`eval echo $EMAIL_SUBJECT` | ||
echo "Email from: " $EMAIL_FROM | ||
echo "Email to: " $EMAIL_TO | ||
echo "Subject: " $subject | ||
# send email using sendmail | ||
printf "Subject: $subject\nSee \$subject :)\n" | /usr/bin/env sendmail -f "$EMAIL_FROM" "$EMAIL_TO" | ||
} | ||
|
||
|
||
shallow_clean() { | ||
echo "**** Cleaning site ****" | ||
rm -rf $DIR/_site | ||
echo "**** Cleaning asciidoc cache ****" | ||
rm -rf $DIR/_tmp/asciidoc | ||
} | ||
|
||
deep_clean() { | ||
echo "**** Cleaning site ****" | ||
rm -rf $DIR/_site | ||
echo "**** Cleaning caches ****" | ||
rm -rf $DIR/_tmp/lanyrd | ||
rm -rf $DIR/_tmp/remote_partial | ||
rm -rf $DIR/_tmp/datacache | ||
rm -rf $DIR/_tmp/restcache | ||
rm -rf $DIR/_tmp/asciidoc | ||
} | ||
|
||
production() { | ||
deep_clean | ||
echo "**** Generating site ****" | ||
bundle exec awestruct -Pproduction | ||
|
||
echo "**** Publishing site to http://${PRODUCTION_URL} ****" | ||
rsync -Pqr --protocol=28 --delete-after --exclude=presentations $DIR/_site/* ${JBORG_DIR}@${JBORG_REPO}/${PRODUCTION_DIR} | ||
|
||
shallow_clean | ||
|
||
read -p "Do you want to send release notifcations to $EMAIL_TO[y/N]? " yn | ||
case $yn in | ||
[Yy]* ) notify_email;; | ||
* ) exit; | ||
esac | ||
} | ||
|
||
staging() { | ||
deep_clean | ||
echo "**** Generating site ****" | ||
bundle exec awestruct -Pstaging | ||
|
||
echo "**** Publishing site to http://${STAGING_URL} ****" | ||
rsync -Pqr --protocol=28 --delete-after --exclude=presentations $DIR/_site/* ${JBORG_DIR}@${JBORG_REPO}/${STAGING_DIR} | ||
|
||
shallow_clean | ||
} | ||
|
||
clear_staging() { | ||
echo "**** Removing staging site from http://${STAGING_URL}" | ||
rm -rf _site | ||
mkdir _site | ||
rsync -Pqr --protocol=28 --delete $DIR/_site/ ${JBORG_DIR}@${JBORG_REPO}/${STAGING_DIR} | ||
} | ||
|
||
|
||
usage() { | ||
cat << EOF | ||
usage: $0 options | ||
This script publishes the Migration Center, either to staging or to production | ||
OPTIONS: | ||
-s Publish staging version of the site to http://${STAGING_URL} | ||
-p Publish production version of the site to http://${PRODUCTION_URL} | ||
-c Clear out all caches | ||
-r Remove the staging version of the site from http://${STAGING_URL} - please do this after using staging | ||
EOF | ||
} | ||
|
||
while getopts "spchr" OPTION | ||
|
||
do | ||
case $OPTION in | ||
s) | ||
staging | ||
exit | ||
;; | ||
r) | ||
clear_staging | ||
exit | ||
;; | ||
p) | ||
production | ||
exit | ||
;; | ||
c) | ||
deep_clean | ||
exit | ||
;; | ||
h) | ||
usage | ||
exit | ||
;; | ||
[?]) | ||
usage | ||
exit | ||
;; | ||
esac | ||
done | ||
|
||
usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/bin/bash | ||
|
||
REQUIRED_BASH_VERSION=3.0.0 | ||
|
||
if [[ $BASH_VERSION < $REQUIRED_BASH_VERSION ]]; then | ||
echo "You must use Bash version 3 or newer to run this script" | ||
exit | ||
fi | ||
|
||
DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P) | ||
|
||
|
||
# DEFINE | ||
|
||
VERSION_REGEX='([0-9]*)\.([0-9]*)([a-zA-Z0-9\.]*)' | ||
|
||
# SCRIPT | ||
|
||
usage() | ||
{ | ||
cat << EOF | ||
usage: $0 options | ||
This script aids in releasing the windup site | ||
OPTIONS: | ||
-u Updates version numbers in all POMs, used with -o and -n | ||
-o Old version number to update from | ||
-n New version number to update to | ||
-h Shows this message | ||
EOF | ||
} | ||
|
||
parse_git_branch() { | ||
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | ||
} | ||
|
||
update() | ||
{ | ||
cd $DIR/ | ||
echo "Updating versions from $OLDVERSION TO $NEWVERSION for all Java and XML files under $PWD" | ||
perl -pi -e "s/version: ${OLDVERSION}/version: ${NEWVERSION}/g" _config/site.yml | ||
} | ||
|
||
OLDVERSION="1.0.0-SNAPSHOT" | ||
NEWVERSION="1.0.0-SNAPSHOT" | ||
VERSION="1.0.0-SNAPSHOT" | ||
CMD="usage" | ||
|
||
while getopts “uo:n:” OPTION | ||
|
||
do | ||
case $OPTION in | ||
u) | ||
CMD="update" | ||
;; | ||
h) | ||
usage | ||
exit | ||
;; | ||
o) | ||
OLDVERSION=$OPTARG | ||
;; | ||
n) | ||
NEWVERSION=$OPTARG | ||
;; | ||
[?]) | ||
usage | ||
exit | ||
;; | ||
esac | ||
done | ||
|
||
$CMD | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/bash | ||
|
||
REQUIRED_BASH_VERSION=3.0.0 | ||
|
||
if [[ $BASH_VERSION < $REQUIRED_BASH_VERSION ]]; then | ||
echo "You must use Bash version 3 or newer to run this script" | ||
exit | ||
fi | ||
|
||
DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P) | ||
|
||
# DEFINE | ||
|
||
VERSION_REGEX='([0-9]*)\.([0-9]*)([a-zA-Z0-9\.]*)' | ||
|
||
|
||
# SCRIPT | ||
|
||
usage() | ||
{ | ||
cat << EOF | ||
usage: $0 options | ||
This script performs a release the windup site | ||
OPTIONS: | ||
-s Snapshot version number to update from | ||
-n New snapshot version number to update to, if undefined, defaults to the version number updated from | ||
-r Release version number | ||
EOF | ||
} | ||
|
||
release() | ||
{ | ||
echo "Releasing windup site version $RELEASEVERSION" | ||
$DIR/release-utils.sh -u -o $SNAPSHOTVERSION -n $RELEASEVERSION | ||
git commit -a -m "Prepare for $RELEASEVERSION release" | ||
git tag -a $RELEASEVERSION -m "Tag $RELEASEVERSION" | ||
$DIR/publish.sh -p | ||
$DIR/release-utils.sh -u -o $RELEASEVERSION -n $NEWSNAPSHOTVERSION | ||
git commit -a -m "Prepare for development of $NEWSNAPSHOTVERSION" | ||
} | ||
|
||
SNAPSHOTVERSION="UNDEFINED" | ||
RELEASEVERSION="UNDEFINED" | ||
NEWSNAPSHOTVERSION="UNDEFINED" | ||
MAJOR_VERSION="UNDEFINED" | ||
MINOR_VERSION="UNDEFINED" | ||
|
||
while getopts “hn:r:s:” OPTION | ||
|
||
do | ||
case $OPTION in | ||
h) | ||
usage | ||
exit | ||
;; | ||
s) | ||
SNAPSHOTVERSION=$OPTARG | ||
;; | ||
r) | ||
RELEASEVERSION=$OPTARG | ||
;; | ||
n) | ||
NEWSNAPSHOTVERSION=$OPTARG | ||
;; | ||
[?]) | ||
usage | ||
exit | ||
;; | ||
esac | ||
done | ||
|
||
if [ "$NEWSNAPSHOTVERSION" == "UNDEFINED" ] | ||
then | ||
NEWSNAPSHOTVERSION=$SNAPSHOTVERSION | ||
fi | ||
|
||
if [ "$SNAPSHOTVERSION" == "UNDEFINED" -o "$RELEASEVERSION" == "UNDEFINED" ] | ||
then | ||
echo "\nMust specify -r and -s\n" | ||
usage | ||
exit | ||
fi | ||
|
||
release | ||
|