Skip to content

Commit

Permalink
Merge pull request #341 from rgbkrk/breakup-release
Browse files Browse the repository at this point in the history
Breakup release script, fix release script for Linux
  • Loading branch information
jrperritt committed Sep 21, 2015
2 parents a92b924 + 911245e commit 857bf72
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 24 deletions.
29 changes: 29 additions & 0 deletions script/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,32 @@ get_version() {

return 0
}

#
# Helper function to do replace; this should work across operating systems
#
update {
TMP_FILE=$(mktemp "$1")
sed -e "$2" "$3" > "$TMP_FILE"
chmod 0644 "$TMP_FILE"
mv -f "$TMP_FILE" "$3"
}

update_docs() {
NEW_VERSION=$1
DOCS_INDEX_FILE="docs/index.rst"
DOCS_CONFIGURATION_FILE="docs/configuration.rst"

#
# Update the docs index paths
#

update ./index.rst-tmpXXX "s#rackcdn\.com/[0-9a-zA-Z.-]*/#rackcdn\.com/$NEW_VERSION/#g" $DOCS_INDEX_FILE

#
# Update the docs configuration paths
#

update ./configuration.rst-tmpXXX "s#rackcdn\.com/[0-9a-zA-Z.-]*/#rackcdn\.com/$NEW_VERSION/#g" $DOCS_CONFIGURATION_FILE

}
31 changes: 7 additions & 24 deletions script/release
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
#!/bin/bash
set -euo pipefail

#
# Helper function to do replace; this should work across operating systems
#

function update {
TMP_FILE=`mktemp $1`
sed -e "$2" $3 > $TMP_FILE
chmod 0644 $TMP_FILE
mv -f $TMP_FILE $3
}
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source "${SCRIPT_DIR}/lib.sh"

NEW_VERSION=${1:-}
REMOTE="release"
REMOTE_URL="[email protected]:rackspace/rack.git"
DOCS_INDEX_FILE="docs/index.rst"
DOCS_CONFIGURATION_FILE="docs/configuration.rst"
BRANCH=$(git rev-parse --abbrev-ref HEAD)


# BRANCH
get_branch

echo "Releasing new version: ${NEW_VERSION}"

Expand Down Expand Up @@ -78,17 +71,7 @@ if [ -n "$SYNC_STATUS" ]; then
exit 5
fi

#
# Update the docs index paths
#

update ./index.rst-version "s#rackcdn\.com/[0-9a-zA-Z.-]*/#rackcdn\.com/$NEW_VERSION/#g" $DOCS_INDEX_FILE

#
# Update the docs configuration paths
#

update ./configuration.rst-version "s#rackcdn\.com/[0-9a-zA-Z.-]*/#rackcdn\.com/$NEW_VERSION/#g" $DOCS_CONFIGURATION_FILE
update_docs "${NEW_VERSION}"

#
# Commit and push the code changes
Expand Down

0 comments on commit 857bf72

Please sign in to comment.