Skip to content

Commit

Permalink
update release script
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed May 29, 2018
1 parent 7112636 commit 0570c22
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 24 deletions.
5 changes: 1 addition & 4 deletions .github_changelog_generator
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
user=mob-sakai
project=UIEffect
issues-wo-labels=false
pr-wo-labels=false
exclude_labels=duplicate,question,invalid,wontfix,Duplicate,Question,Invalid,Wontfix,Meta: Exclude From Changelog,unreleased
unreleased=false
exclude_labels=duplicate,question,invalid,wontfix,Duplicate,Question,Invalid,Wontfix,Meta: Exclude From Changelog
55 changes: 35 additions & 20 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,52 @@


# input release version
echo -e "\n>> Start Github Release:"
PACKAGE_NAME=`node -pe 'require("./package.json").name'`
echo Github Release: $PACKAGE_NAME
read -p "[? release version (for example: 1.0.0): " RELEASE_VERSION
[ -z "$RELEASE_VERSION" ] && exit
echo -e ">> Package name: ${PACKAGE_NAME}"
CURRENT_VERSION=`grep -o -e "\"version\".*$" package.json | sed -e "s/\"version\": \"\(.*\)\".*$/\1/"`
read -p "[? release version (for current: ${CURRENT_VERSION}): " RELEASE_VERSION
[ -z "${RELEASE_VERSION}" ] && exit


# update version in package.json
echo -e "\n>> Update version... package.json"
git checkout -B release develop
sed -i -e "s/\"version\": \(.*\)/\"version\": \"${RELEASE_VERSION}\",/g" package.json


# generate change log
TAG=v$RELEASE_VERSION
git tag $TAG
git push --tags
github_changelog_generator
git tag -d $TAG
git push --delete origin $TAG
# check unity editor
UNITY_VER=`sed -e "s/m_EditorVersion: \(.*\)/\1/g" ProjectSettings/ProjectVersion.txt`
UNITY_EDITOR="/Applications/Unity/Hub/Editor/${UNITY_VER}/Unity.app/Contents/MacOS/Unity"
echo -e "\n>> Check unity editor... ${UNITY_VER} (${UNITY_EDITOR})"
"$UNITY_EDITOR" -quit -batchmode -projectPath "`pwd`"
echo -e ">> OK"

# generate change log
CHANGELOG_GENERATOR_ARG=`grep -o -e ".*git\"$" package.json | sed -e "s/^.*\/\([^\/]*\)\/\([^\/]*\).git.*$/--user \1 --project \2/"`
CHANGELOG_GENERATOR_ARG="--future-release v${RELEASE_VERSION} ${CHANGELOG_GENERATOR_ARG}"
echo -e "\n>> Generate change log... ${CHANGELOG_GENERATOR_ARG}"
# TAG=v$RELEASE_VERSION
# git tag $TAG
# git push --tags
github_changelog_generator ${CHANGELOG_GENERATOR_ARG}
# git tag -d $TAG
# git push --delete origin $TAG

git diff -- CHANGELOG.md
read -p "[? continue? (y/N):" yn
read -p "[? is the change log correct? (y/N):" yn
case "$yn" in [yY]*) ;; *) exit ;; esac


# export unitypackage
UNITY_EDITOR=`node -pe 'require("./package.json").unity'`
PACKAGE_SRC=`node -pe 'require("./package.json").src'`
"$UNITY_EDITOR" -quit -batchmode -projectPath "`pwd`" -exportpackage "$PACKAGE_SRC" "$PACKAGE_NAME.unitypackage"


# commit files
# commit release files
echo -e "\n>> Commit release files..."
git add CHANGELOG.md -f
git add package.json -f
git commit -m "update change log"


# merge and push
echo -e "\n>> Merge and push..."
git checkout master
git merge --no-ff release -m "release $TAG"
git branch -D release
Expand All @@ -60,8 +68,15 @@ git merge --ff master
git push origin develop


# export unitypackage
PACKAGE_SRC=`node -pe 'require("./package.json").src'`
echo -e "\n>> Export unitypackage... ${PACKAGE_SRC}"
"$UNITY_EDITOR" -quit -batchmode -projectPath "`pwd`" -exportpackage "$PACKAGE_SRC" "$PACKAGE_NAME.unitypackage"
echo -e ">> OK"


# upload unitypackage and release on Github
gh-release --draft --assets "$PACKAGE_NAME.unitypackage"
gh-release --assets "$PACKAGE_NAME.unitypackage"


echo "\n\n$PACKAGE_NAME v$RELEASE_VERSION has been successfully released!\n"
echo -e "\n\n>> $PACKAGE_NAME v$RELEASE_VERSION has been successfully released!\n"

0 comments on commit 0570c22

Please sign in to comment.