OSDN Git Service

Added utility. v0.2.0
authorShinichiro Nakamura <shinta.main.jp@gmail.com>
Tue, 18 Dec 2012 06:53:27 +0000 (15:53 +0900)
committerShinichiro Nakamura <shinta.main.jp@gmail.com>
Tue, 18 Dec 2012 06:53:27 +0000 (15:53 +0900)
create-release.sh [new file with mode: 0755]

diff --git a/create-release.sh b/create-release.sh
new file mode 100755 (executable)
index 0000000..b4cda4b
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+#
+# Variables
+#
+MODULE_NAME=kz_h8write
+VERSION_NUMBER=$1
+TAG_NAME="v$VERSION_NUMBER"
+FILE_NAME="$MODULE_NAME-$TAG_NAME.tar.gz"
+RELEASE_FILES="doc/ example/ src/"
+
+GIT_STATUS=`git status`
+GIT_TAG=`git tag`
+STATUS_CHECK=`echo $GIT_STATUS | grep 'working directory clean' | wc -l`
+TAG_CHECK=`echo $GIT_TAG | grep "$1" | wc -l`
+
+#
+# Status check
+#
+if [ "$VERSION_NUMBER" = "" ]
+then
+  echo "create-release.sh [version number]"
+  exit
+fi
+
+if [ "$STATUS_CHECK" = "0" ]
+then
+  echo "Please check this working directory."
+  echo "This working directory changes something."
+  exit
+fi
+
+if [ ! "$TAG_CHECK" = "0" ]
+then
+  echo "The specified version already exists."
+  exit
+fi
+
+#
+# Create the release
+#
+echo '=========================================='
+echo "MODULE :$MODULE_NAME"
+echo "VERSION:$VERSION_NUMBER"
+echo "FILE   :$FILE_NAME"
+echo '=========================================='
+
+git tag $TAG_NAME
+tar cvfz $FILE_NAME $RELEASE_FILES
+
+#
+# Messages
+#
+echo "Please execute following command to fix the tag for the new release."
+echo "  git push --tags  "
+