Update the release folder on a repository basis (#223)

Since we support to release the OpenWhisk modules separately, this
PR implemented it based on the configuration file. We can define
the modules to be released, instead of releasing all the aritfacts
within the staging folder.
diff --git a/releases/0.9.0-incubating/INSTALL.md b/releases/0.9.0-incubating/INSTALL.md
index f4415e4..39d2be0 100644
--- a/releases/0.9.0-incubating/INSTALL.md
+++ b/releases/0.9.0-incubating/INSTALL.md
@@ -19,11 +19,11 @@
 
 # Download OpenWhisk
 
-The OpenWhisk source code may be downloaded from https://dist.apache.org/repos/dist/dev/incubator/openwhisk/apache-openwhisk-0.9.0-incubating-rc2. The current release is version 0.9.0, and the artifact for this OpenWhisk source code release is called `"openwhisk-0.9.0-incubating-sources.tar.gz"`.
+The OpenWhisk source code may be downloaded from https://dist.apache.org/repos/dist/release/incubator/openwhisk/apache-openwhisk-0.9.0-incubating. The current release is version 0.9.0, and the artifact for this OpenWhisk source code release is called `"openwhisk-0.9.0-incubating-sources.tar.gz"`.
 
 ```
 # download from your terminal with wget
-wget https://dist.apache.org/repos/dist/dev/incubator/openwhisk/apache-openwhisk-0.9.0-incubating-rc2/openwhisk-0.9.0-incubating-sources.tar.gz
+wget https://dist.apache.org/repos/dist/release/incubator/openwhisk/apache-openwhisk-0.9.0-incubating/openwhisk-0.9.0-incubating-sources.tar.gz
 ```
 
 # Verify the SHA-512 checksums, and signature
@@ -42,7 +42,7 @@
 
 Before using `gpg` to verify the OpenWhisk release integrity, you should [verify `gpg`'s own integrity](https://gnupg.org/download/integrity_check.html).
 
-The public key used to verify the OpenWhisk checksums can be found [here](https://dist.apache.org/repos/dist/dev/incubator/openwhisk/KEYS). Download the key and import it on your local machine.
+The public key used to verify the OpenWhisk checksums can be found [here](https://dist.apache.org/repos/dist/release/incubator/openwhisk/KEYS). Download the key and import it on your local machine.
 
 ```
 gpg --import <key_file>
@@ -56,9 +56,9 @@
 gpg --print-md SHA512 <artifact>
 ```
 
-The parameter <artifact> is the file of the artifact `"openwhisk-0.9.0-incubating-sources.tar.gz"`. Compare the content with the [SHA512 file](https://dist.apache.org/repos/dist/dev/incubator/openwhisk/apache-openwhisk-0.9.0-incubating-rc2/openwhisk-0.9.0-incubating-sources.tar.gz.sha512).
+The parameter <artifact> is the file of the artifact `"openwhisk-0.9.0-incubating-sources.tar.gz"`. Compare the content with the [SHA512 file](https://dist.apache.org/repos/dist/release/incubator/openwhisk/apache-openwhisk-0.9.0-incubating/openwhisk-0.9.0-incubating-sources.tar.gz.sha512).
 
-Download the [signature](https://dist.apache.org/repos/dist/dev/incubator/openwhisk/apache-openwhisk-0.9.0-incubating-rc2/openwhisk-0.9.0-incubating-sources.tar.gz.asc), and verify it with the command:
+Download the [signature](https://dist.apache.org/repos/dist/release/incubator/openwhisk/apache-openwhisk-0.9.0-incubating/openwhisk-0.9.0-incubating-sources.tar.gz.asc), and verify it with the command:
 
 ```
 gpg --verify openwhisk-0.9.0-incubating-sources.tar.gz.asc openwhisk-0.9.0-incubating-sources.tar.gz
diff --git a/tools/move_stage_to_release.sh b/tools/move_stage_to_release.sh
index 6a81e40..abc2d3e 100755
--- a/tools/move_stage_to_release.sh
+++ b/tools/move_stage_to_release.sh
@@ -26,13 +26,30 @@
 
 source "$SCRIPTDIR/load_config.sh" "$SVN_USERNAME" "$SVN_PASSWORD"
 
-if [[ `wget -S --spider $RELEASE_VERSION_URL  2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then
-    svn delete $RELEASE_VERSION_URL -m "Removing Apache OpenWhisk release ${full_version}." $CREDENTIALS
+if [[ `wget -S --spider $RELEASE_VERSION_URL  2>&1 | grep 'HTTP/1.1 404 Not Found'` ]]; then
+    svn mkdir $RELEASE_VERSION_URL -m "Creating Apache OpenWhisk release ${version}." $CREDENTIALS
 fi
 
-if [[ `wget -S --spider $CURRENT_VERSION_URL  2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then
-    svn copy $CURRENT_VERSION_URL $RELEASE_URL -m "Releasing Apache OpenWhisk release ${full_version}." $CREDENTIALS
-    if [ "$full_version" != "$version" ]; then
-        svn mv $RELEASE_VERSION_URL_STAGE $RELEASE_VERSION_URL -m "Remaning the directory from ${full_version} to ${version}." $CREDENTIALS
-    fi
-fi
+# Create a subversion directory for openwhisk to stage all the packages
+rm -rf $OPENWHISK_SVN
+mkdir -p $OPENWHISK_SVN
+cd $OPENWHISK_SVN
+
+# Check out the artifacts in the staging URL to a local directory.
+svn co $CURRENT_VERSION_URL $REMOTE_PATH
+
+# Check out the release directory to a local directory.
+svn co $RELEASE_VERSION_URL $REMOTE_PATH_RELEASE
+
+for repo in $(echo $repos | sed "s/,/ /g")
+do
+    repo_name=$(echo "$repo" | sed -e 's/^"//' -e 's/"$//')
+    cp ${REMOTE_PATH}/${repo_name}-${version}-sources.tar.gz* ${REMOTE_PATH_RELEASE}/
+done
+
+# Copy the documents into the release folder
+cp -R ${REMOTE_PATH}/doc ${REMOTE_PATH_RELEASE}/
+
+cd $REMOTE_PATH_RELEASE
+svn add --force * $CREDENTIALS
+svn commit -m "Updating Apache OpenWhisk release ${version}." $CREDENTIALS