Repository: incubator-myriad
Updated Branches:
  refs/heads/master 3daab13e5 -> bcf277843


Scripts to help with Apache Releases


Project: http://git-wip-us.apache.org/repos/asf/incubator-myriad/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-myriad/commit/bf393cf9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-myriad/tree/bf393cf9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-myriad/diff/bf393cf9

Branch: refs/heads/master
Commit: bf393cf9b17a4f4970eb46ac16f9421201696dcb
Parents: 06f6ca4
Author: smarella <smare...@maprtech.com>
Authored: Wed Dec 9 23:28:31 2015 -0800
Committer: smarella <smare...@maprtech.com>
Committed: Wed Dec 9 23:28:31 2015 -0800

----------------------------------------------------------------------
 support/apache-release/prepare_rc.sh | 102 +++++++++++++++++++++++++++++
 support/apache-release/release.sh    | 105 ++++++++++++++++++++++++++++++
 2 files changed, 207 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/bf393cf9/support/apache-release/prepare_rc.sh
----------------------------------------------------------------------
diff --git a/support/apache-release/prepare_rc.sh 
b/support/apache-release/prepare_rc.sh
new file mode 100755
index 0000000..e6c893d
--- /dev/null
+++ b/support/apache-release/prepare_rc.sh
@@ -0,0 +1,102 @@
+#!/usr/bin/env bash
+
+# 1. Tags the HEAD on the 'master' branch with 
+#    'myriad-<version>-incubating-rc<RC#>'.
+# 2. Creates release artifacts and signs them with GPG key.
+# 3. Uploads the release artifacts to "dev" SVN.
+
+test ${#} -eq 2 || \
+  { echo "Usage: `basename ${0}` [myriad version] [rc #]"; exit 1; }
+
+VERSION=${1}
+RC=${2}
+
+TAG="myriad-${VERSION}-incubating-rc${RC}"
+GIT_URL="https://git-wip-us.apache.org/repos/asf/incubator-myriad.git";
+WORK_DIR="."
+
+echo "Preparing a release candidate ${TAG}.."
+
+TEMP="temp"
+# clone the repo to "temp"
+git clone $GIT_URL ${TEMP}|| \
+  { echo "Failed to clone Myriad from ${GIT_URL} into ${TEMP}"; exit 1; }
+
+# perform a build
+pushd ${TEMP}
+./gradlew build || \
+  { echo "Failed to build Myriad."; exit 1; }
+
+echo "Creating git tag ${TAG} and pushing to ${GIT_URL} ...${NORMAL}"
+git tag ${TAG}
+git push ${GIT_URL} refs/tags/${TAG}
+
+popd # temp
+
+# make a fresh clone that syncs to ${TAG}
+git clone $GIT_URL ${TAG} --branch ${TAG} || \
+  { echo "Failed to clone Myriad from ${GIT_URL}"; exit 1; }
+
+# Remove files/folders that shouldn't be included in the release artifacts
+rm -rf ${TAG}/website
+rm -rf ${TAG}/gradlew.bat
+rm -rf ${TAG}/gradlew
+rm -rf ${TAG}/gradle/wrapper
+rm -rf ${TAG}/.travis.yml
+rm -rf ${TAG}/myriad-scheduler/src/main/resources/banner.txt
+
+# Create a tar ball that excludes VCS files
+TARBALL=${TAG}.tar.gz
+tar -czf ${TARBALL} ${TAG} --exclude-vcs || \
+  { echo "Failed to create a tarball of ${TAG}"; exit 1; }
+
+# Sign the tarball.
+echo "Signing the distribution ..."
+gpg --armor --output ${TARBALL}.asc --detach-sig ${TARBALL} || \
+  { echo "Failed to sign the tarball ${TARBALL}"; exit 1; }
+
+# Create MD5 checksum.
+echo "Creating a MD5 checksum..."
+gpg --print-md MD5 ${TARBALL} > ${TARBALL}.md5 || \
+  { echo "Failed to create MD5 checksum for tarball ${TARBALL}"; exit 1; }
+
+# Create SHA512 checksum.
+echo "Creating a SHA512 checksum..."
+gpg --print-md SHA512 ${TARBALL} > ${TARBALL}.sha512 || \
+  { echo "Failed to create SHA512 checksum for tarball ${TARBALL}"; exit 1; }
+
+SVN_DEV_REPO="https://dist.apache.org/repos/dist/dev/incubator/myriad";
+SVN_DEV_LOCAL="${WORK_DIR}/dev"
+
+echo "Checking out svn dev repo from ${SVN_DEV_REPO}..."
+
+# Note '--depth=empty' ensures none of the existing files
+# in the repo are checked out, saving time and space.
+svn co --depth=empty ${SVN_DEV_REPO} ${SVN_DEV_LOCAL} || \
+  { echo "Failed to checkout SVN repo from ${SVN_DEV_REPO} to 
${SVN_DEV_LOCAL}"; exit 1; }
+
+RELEASE_DIRECTORY="${SVN_DEV_LOCAL}/${TAG}"
+mkdir ${RELEASE_DIRECTORY}
+mv ${TARBALL} ${TARBALL}.asc ${TARBALL}.md5 ${TARBALL}.sha512 
${RELEASE_DIRECTORY}
+echo "Release artifacts moved into ${RELEASE_DIRECTORY}"
+
+pushd ${SVN_DEV_LOCAL}
+
+while true; do
+    read -p "PUSH THE ARTIFACTS TO ${SVN_DEV_REPO}/${TAG} ? " yn
+    case $yn in
+        [Yy]* ) break;;
+        [Nn]* ) echo "OK. Goodbye..!"; exit;;
+        * ) echo "Please answer yes or no.";;
+    esac
+done
+
+echo "Uploading the artifacts (the distribution," \
+  "signature, MD5 and SHA) to ${SVN_DEV_REPO}/${TAG} ...."
+
+svn add ${TAG}
+svn commit -m "Adding ${TAG}."
+popd # ${SVN_DEV_LOCAL}
+
+echo "All good!"
+

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/bf393cf9/support/apache-release/release.sh
----------------------------------------------------------------------
diff --git a/support/apache-release/release.sh 
b/support/apache-release/release.sh
new file mode 100755
index 0000000..157fb19
--- /dev/null
+++ b/support/apache-release/release.sh
@@ -0,0 +1,105 @@
+#!/usr/bin/env bash
+
+# 1. Tags the successfully voted RC with
+#    'myriad-<version>-incubating'.
+# 2. Pushes the release tag to git.
+# 3. Deletes the previously tagged RC tags.
+# 4. Uploads the release artifacts to "release" SVN.
+# 5. Deletes the previously available RC artifacts from "dev" SVN.
+
+function askAndGo() {
+while true; do
+    read -p "$1 ?" yn
+    case $yn in
+        [Yy]* ) break;;
+        [Nn]* ) echo "OK. Goodbye..!"; exit;;
+        * ) echo "Please answer yes or no.";;
+    esac
+done
+}
+
+#main
+test ${#} -eq 2 || \
+  { echo "Usage: `basename ${0}` [myriad version] [voted rc#]"; exit 1; }
+
+VERSION=${1}
+RC=${2}
+
+RC_TAG="myriad-${VERSION}-incubating-rc${RC}"
+RELEASE_TAG="myriad-${VERSION}-incubating"
+GIT_URL="https://git-wip-us.apache.org/repos/asf/incubator-myriad.git";
+WORK_DIR="."
+
+echo "Preparing a release ${RELEASE_TAG}.."
+
+TEMP="temp"
+# clone the repo to "temp"
+git clone $GIT_URL ${TEMP}|| \
+  { echo "Failed to clone Myriad from ${GIT_URL} into ${TEMP}"; exit 1; }
+
+pushd ${TEMP}
+echo "Creating new release tag '${RELEASE_TAG}' and pushing it to ${GIT_URL} 
..."
+git tag ${RELEASE_TAG} ${RC_TAG}
+echo "Git tags for version ${VERSION}: "
+git log --pretty=oneline --abbrev-commit --decorate | grep "tag:" | grep 
${VERSION}
+askAndGo "Push tag '${RELEASE_TAG}' to ${GIT_URL}"
+git push origin refs/tags/${RELEASE_TAG}
+
+echo "Deleting (now) old RC git tags..."
+for i in `git tag -l | grep ${VERSION} | grep "rc"`;
+do
+  git tag -d ${i}
+  askAndGo "Delete tag '${i}' from ${GIT_URL}"
+  git push origin :refs/tags/${i}
+done
+popd # temp
+
+SVN_DEV_REPO="https://dist.apache.org/repos/dist/dev/incubator/myriad";
+SVN_RELEASE_REPO="https://dist.apache.org/repos/dist/release/incubator/myriad";
+SVN_DEV_LOCAL="${WORK_DIR}/dev"
+SVN_RELEASE_LOCAL="${WORK_DIR}/release"
+
+echo "Checking out svn dev repo from ${SVN_DEV_REPO} to ${SVN_DEV_LOCAL}..."
+svn co ${SVN_DEV_REPO} ${SVN_DEV_LOCAL} || \
+  { echo "Failed to checkout SVN repo from ${SVN_DEV_REPO} to 
${SVN_DEV_LOCAL}"; exit 1; }
+
+echo "Checking out svn release repo from ${SVN_RELEASE_REPO} to 
${SVN_RELEASE_LOCAL}..."
+svn co ${SVN_RELEASE_REPO} ${SVN_RELEASE_LOCAL} || \
+  { echo "Failed to checkout SVN repo from ${SVN_RELEASE_REPO} to 
${SVN_RELEASE_LOCAL}"; exit 1; }
+
+mkdir ${SVN_RELEASE_LOCAL}/${RELEASE_TAG}
+echo "Copying release artifacts under ${SVN_DEV_LOCAL}/${RC_TAG} to 
${SVN_RELEASE_LOCAL}/${RELEASE_TAG}..."
+cp ${SVN_DEV_LOCAL}/${RC_TAG}/${RC_TAG}.tar.gz 
${SVN_RELEASE_LOCAL}/${RELEASE_TAG}/${RELEASE_TAG}.tar.gz
+cp ${SVN_DEV_LOCAL}/${RC_TAG}/${RC_TAG}.tar.gz.asc 
${SVN_RELEASE_LOCAL}/${RELEASE_TAG}/${RELEASE_TAG}.tar.gz.asc
+cp ${SVN_DEV_LOCAL}/${RC_TAG}/${RC_TAG}.tar.gz.md5 
${SVN_RELEASE_LOCAL}/${RELEASE_TAG}/${RELEASE_TAG}.tar.gz.md5
+cp ${SVN_DEV_LOCAL}/${RC_TAG}/${RC_TAG}.tar.gz.sha512 
${SVN_RELEASE_LOCAL}/${RELEASE_TAG}/${RELEASE_TAG}.tar.gz.sha512
+
+pushd ${SVN_RELEASE_LOCAL}
+echo "Release artifacts under ${SVN_RELEASE_LOCAL}/${RELEASE_TAG}:"
+ls ${RELEASE_TAG}
+askAndGo "PUSH THE ${RELEASE_TAG} ARTIFACTS TO 
${SVN_RELEASE_REPO}/${RELEASE_TAG}"
+svn add ${RELEASE_TAG}
+svn commit -m "Adding ${RELEASE_TAG}."
+popd # ${SVN_RELEASE_LOCAL}
+
+askAndGo "PROCEED TO DELETE OLD RCs FROM ${SVN_DEV_REPO}/"
+echo "Old RCs in ${SVN_DEV_REPO}:"
+ls ${SVN_DEV_LOCAL} | grep ${VERSION}
+
+### delete old RCs
+pushd ${SVN_DEV_LOCAL}
+for i in `ls | grep ${VERSION}`
+do
+  askAndGo "DELETE $i FROM ${SVN_DEV_REPO}/"
+  svn delete $i
+  svn commit -m "Deleting $i as ${RELEASE_TAG} is committed to 
${SVN_RELEASE_REPO}."
+done
+popd # ${SVN_DEV_LOCAL}
+
+echo "All good!"
+askAndGo "Cleanup local repos"
+rm -rf ${TEMP}
+rm -rf ${SVN_DEV_LOCAL}
+rm -rf ${SVN_RELEASE_LOCAL}
+echo "All clean :)"
+

Reply via email to