From bcf97b60bd8309b6fa5e3e711eb5a444a91f3049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E5=8B=87=E5=8D=87=20pengys?= <8082209@qq.com> Date: Wed, 4 Apr 2018 14:35:02 +0800 Subject: [PATCH] Source release from the new codes by git clone. (#1023) --- tools/releasing/create_source_release.sh | 51 ++++++++++++++++-------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/tools/releasing/create_source_release.sh b/tools/releasing/create_source_release.sh index 1680e2b28..ab6704229 100755 --- a/tools/releasing/create_source_release.sh +++ b/tools/releasing/create_source_release.sh @@ -17,14 +17,22 @@ # limitations under the License. # -## -## Variables with defaults (if not overwritten by environment) -## +# This script relies on few environment variables to determine source code package +# behavior, those variables are: +# RELEASE_VERSION -- The version of this source package. +# For example: RELEASE_VERSION=5.0.0-alpha + + RELEASE_VERSION=${RELEASE_VERSION} +TAG_NAME="v"${RELEASE_VERSION} PRODUCT_NAME="apache-skywalking-apm-incubating" +echo "Release version "${RELEASE_VERSION} +echo "Source tag "${TAG_NAME} + if [ "$RELEASE_VERSION" == "" ]; then - echo "RELEASE_VERSION variable is null" + echo "RELEASE_VERSION environment variable not found, Please setting the RELEASE_VERSION." + echo "For example: export RELEASE_VERSION=5.0.0-alpha" exit 1 fi @@ -35,18 +43,29 @@ PRODUCT_NAME=${PRODUCT_NAME}-${RELEASE_VERSION} rm -rf ${PRODUCT_NAME} mkdir ${PRODUCT_NAME} -rsync -a ../../ \ - --exclude ".git" --exclude ".gitignore" --exclude ".gitattributes" --exclude ".travis.yml" \ - --exclude "deploysettings.xml" --exclude "CHANGELOG" --exclude ".github" --exclude "target" \ - --exclude ".idea" --exclude "*.iml" --exclude ".DS_Store" --exclude "build-target" \ - --exclude "/docs/" --exclude "/dist/" --exclude "/tools/" --exclude "/skywalking-agent/" \ - --exclude "/skywalking-ui/dist/" --exclude "/skywalking-ui/node/" --exclude "/skywalking-ui/node_modules/" \ - --exclude "dependency-reduced-pom.xml" \ - ${PRODUCT_NAME} +git clone https://github.com/apache/incubator-skywalking.git ./${PRODUCT_NAME} +cd ${PRODUCT_NAME} -tar czf ${PRODUCT_NAME}-src.tgz ${PRODUCT_NAME} +TAG_EXIST=`git tag -l ${TAG_NAME} | wc -l` -gpg --armor --detach-sig $PRODUCT_NAME-src.tgz +if [ ${TAG_EXIST} -ne 1 ]; then + echo "Could not find the tag named" ${TAG_NAME} + exit 1 +fi -md5 -r $PRODUCT_NAME-src.tgz > $PRODUCT_NAME-src.tgz.md5 -shasum -a 512 $PRODUCT_NAME-src.tgz > $PRODUCT_NAME-src.tgz.sha512 +git checkout ${TAG_NAME} + +git submodule init +git submodule update + +cd .. + +tar czf ${PRODUCT_NAME}-src.tgz \ + --exclude ${PRODUCT_NAME}/.git/ --exclude ${PRODUCT_NAME}/.DS_Store/ \ + --exclude ${PRODUCT_NAME}/.github/ --exclude ${PRODUCT_NAME}/.gitignore/ \ + --exclude ${PRODUCT_NAME}/.gitmodules/ --exclude ${PRODUCT_NAME}/.travis.yml \ + ${PRODUCT_NAME} + +gpg --armor --detach-sig ${PRODUCT_NAME}-src.tgz + +shasum -a 512 ${PRODUCT_NAME}-src.tgz > ${PRODUCT_NAME}-src.tgz.sha512 \ No newline at end of file