add release script (#34)

* add release script

* add release script

Co-authored-by: Evan <evanljp@outlook.com>
diff --git a/Makefile b/Makefile
index 526ce49..5238c45 100644
--- a/Makefile
+++ b/Makefile
@@ -96,33 +96,10 @@
 docker:
 	docker build --build-arg VERSION=$(VERSION) -t apache/skywalking-satellite:$(VERSION) --no-cache . -f docker/Dockerfile
 
-release-src: clean
-	-tar -zcvf $(RELEASE_SRC).tgz \
-	--exclude bin \
-	--exclude .git \
-	--exclude .idea \
-	--exclude .DS_Store \
-	--exclude .github \
-	--exclude $(RELEASE_SRC).tgz \
-	--exclude protocol/gen-codes \
-	.
-
-release-bin: build
-	-mkdir $(RELEASE_BIN)
-	-cp -R bin $(RELEASE_BIN)
-	-cp -R configs $(RELEASE_BIN)
-	-cp -R dist/* $(RELEASE_BIN)
-	-cp -R CHANGES.md $(RELEASE_BIN)
-	-cp -R README.md $(RELEASE_BIN)
-	-tar -zcvf $(RELEASE_BIN).tgz $(RELEASE_BIN)
-	-rm -rf $(RELEASE_BIN)
-
 .PHONY: release
-release: verify release-src release-bin
-	gpg --batch --yes --armor --detach-sig $(RELEASE_SRC).tgz
-	shasum -a 512 $(RELEASE_SRC).tgz > $(RELEASE_SRC).tgz.sha512
-	gpg --batch --yes --armor --detach-sig $(RELEASE_BIN).tgz
-	shasum -a 512 $(RELEASE_BIN).tgz > $(RELEASE_BIN).tgz.sha512
+release:
+	/bin/sh tools/release/create_bin_release.sh
+	/bin/sh tools/release/create_source_release.sh
 
 .PHONY: $(PLATFORMS)
 $(PLATFORMS):
diff --git a/docs/en/guides/contribution/How-to-release.md b/docs/en/guides/contribution/How-to-release.md
index 354e522..ad5dbd8 100644
--- a/docs/en/guides/contribution/How-to-release.md
+++ b/docs/en/guides/contribution/How-to-release.md
@@ -24,7 +24,7 @@
 git clone --recurse-submodules git@github.com:apache/skywalking-satellite && cd skywalking-satellite
 git tag -a "$VERSION" -m "Release Apache SkyWalking-Satellite $VERSION"
 git push --tags
-make clean && make release
+make release
 ```
 
 **In total, six files should be automatically generated in the directory**: `skywalking-satellite-${VERSION}-bin.tgz`, `skywalking-satellite-${VERSION}-src.tgz`, and their corresponding `asc`, `sha512` files.
diff --git a/tools/release/create_bin_release.sh b/tools/release/create_bin_release.sh
new file mode 100644
index 0000000..d057cce
--- /dev/null
+++ b/tools/release/create_bin_release.sh
@@ -0,0 +1,80 @@
+#!/usr/bin/env bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This script relies on few environment variables to determine source code package
+# behavior, those variables are:
+#   VERSION -- The version of this source package.
+# For example: VERSION=0.1.0
+
+
+VERSION=${VERSION}
+TAG_NAME=v${VERSION}
+
+PRODUCT_NAME="apache-skywalking-satellite"
+
+echo "Release version "${VERSION}
+echo "Source tag "${TAG_NAME}
+
+if [ "$VERSION" == "" ]; then
+  echo "VERSION environment variable not found, Please setting the VERSION."
+  echo "For example: export VERSION=0.1.0"
+  exit 1
+fi
+
+echo "Creating source package"
+
+PRODUCT_NAME=${PRODUCT_NAME}-${VERSION}
+
+rm -rf ${PRODUCT_NAME}
+mkdir ${PRODUCT_NAME}
+
+git clone https://github.com/apache/skywalking-satellite.git ./${PRODUCT_NAME}
+cd ${PRODUCT_NAME}
+
+TAG_EXIST=`git tag -l ${TAG_NAME} | wc -l`
+
+if [ ${TAG_EXIST} -ne 1 ]; then
+    echo "Could not find the tag named" ${TAG_NAME}
+    exit 1
+fi
+
+git checkout ${TAG_NAME}
+
+git submodule init
+git submodule update
+
+make build
+
+cd ..
+
+RELEASE_BIN=${PRODUCT_NAME}-bin
+
+mkdir ${RELEASE_BIN}
+cp -R ${PRODUCT_NAME}/bin ${RELEASE_BIN}
+cp -R ${PRODUCT_NAME}/configs ${RELEASE_BIN}
+cp -R ${PRODUCT_NAME}/dist/* ${RELEASE_BIN}
+cp -R ${PRODUCT_NAME}/CHANGES.md ${RELEASE_BIN}
+cp -R ${PRODUCT_NAME}/README.md ${RELEASE_BIN}
+
+tar -zcvf ${RELEASE_BIN}.tgz ${RELEASE_BIN} && rm -rf ${RELEASE_BIN}
+
+gpg --batch --yes --armor --detach-sig ${RELEASE_BIN}.tgz
+shasum -a 512 ${RELEASE_BIN}.tgz > ${RELEASE_BIN}.tgz.sha512
+
+rm -rf ${PRODUCT_NAME}
diff --git a/tools/release/create_source_release.sh b/tools/release/create_source_release.sh
new file mode 100644
index 0000000..1d5b257
--- /dev/null
+++ b/tools/release/create_source_release.sh
@@ -0,0 +1,79 @@
+#!/usr/bin/env bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This script relies on few environment variables to determine source code package
+# behavior, those variables are:
+#   VERSION -- The version of this source package.
+# For example: VERSION=0.1.0
+
+
+VERSION=${VERSION}
+TAG_NAME=v${VERSION}
+PRODUCT_NAME="apache-skywalking-satellite"
+
+echo "Release version "${VERSION}
+echo "Source tag "${TAG_NAME}
+
+if [ "$VERSION" == "" ]; then
+  echo "VERSION environment variable not found, Please setting the VERSION."
+  echo "For example: export VERSION=0.1.0"
+  exit 1
+fi
+
+echo "Creating source package"
+
+PRODUCT_NAME=${PRODUCT_NAME}-${VERSION}
+
+rm -rf ${PRODUCT_NAME}
+mkdir ${PRODUCT_NAME}
+
+git clone https://github.com/apache/skywalking-satellite.git ./${PRODUCT_NAME}
+cd ${PRODUCT_NAME}
+
+TAG_EXIST=`git tag -l ${TAG_NAME} | wc -l`
+
+if [ ${TAG_EXIST} -ne 1 ]; then
+    echo "Could not find the tag named" ${TAG_NAME}
+    exit 1
+fi
+
+git checkout ${TAG_NAME}
+
+git submodule init
+git submodule update
+
+cd ..
+
+
+tar -zcvf ${PRODUCT_NAME}-src.tgz \
+	--exclude bin \
+	--exclude .git \
+	--exclude .DS_Store \
+	--exclude .github \
+	--exclude .gitignore \
+	--exclude .gitmodules \
+	--exclude .gitattributes \
+	--exclude ${PRODUCT_NAME}-src.tgz \
+	--exclude protocol/gen-codes \
+	${PRODUCT_NAME}
+
+gpg --batch --yes --armor --detach-sig ${PRODUCT_NAME}-src.tgz
+shasum -a 512 ${PRODUCT_NAME}-src.tgz > ${PRODUCT_NAME}-src.tgz.sha512
+
+rm -rf ${PRODUCT_NAME}