Skip to content

Commit 8b09edf

Browse files
author
Takashi Sakai
committed
update release script
1 parent 1b6779a commit 8b09edf

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

release.sh

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,78 @@
11
#!/bin/bash -e
22

3+
# NOTE: Set an environment variable `CHANGELOG_GITHUB_TOKEN` by running the following command at the prompt, or by adding it to your shell profile (e.g., ~/.bash_profile or ~/.zshrc):
4+
# export CHANGELOG_GITHUB_TOKEN="«your-40-digit-github-token»"
5+
36
# Release the project with the following steps:
47
# 1. Update the release version in package.json.
58
# 2. Update "CHANGELOG.md" using "github_changelog_generator-1.15.0.pre.rc".
69
# 3. Commit package.json and CHANGELOG.md.
710
# 4. Merge into master branch.
811
# 5. Export unitypackage.
912
# 6. Release using "gh-release-3.2.0". (Upload unitypackage)
10-
UNITY_PATH=/Applications/Unity5.5.0p4/Unity5.5.0p4.app/Contents/MacOS/Unity
1113

1214

13-
# input version
15+
# input release version
1416
PACKAGE_NAME=`node -pe 'require("./package.json").name'`
1517
echo Github Release: $PACKAGE_NAME
1618
read -p "[? release version (for example: 1.0.0): " RELEASE_VERSION
1719
[ -z "$RELEASE_VERSION" ] && exit
1820

1921

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

2427

28+
# check unity editor
29+
UNITY_VER=`sed -e "s/m_EditorVersion: \(.*\)/\1/g" ProjectSettings/ProjectVersion.txt`
30+
UNITY_EDITOR="/Applications/Unity/Hub/Editor/${UNITY_VER}/Unity.app/Contents/MacOS/Unity"
31+
echo -e "\n>> Check unity editor... ${UNITY_VER} (${UNITY_EDITOR})"
32+
"$UNITY_EDITOR" -quit -batchmode -projectPath "`pwd`"
33+
echo -e ">> OK"
34+
2535
# generate change log
36+
echo -e "\n>> Generate change log..."
2637
TAG=v$RELEASE_VERSION
2738
git tag $TAG
2839
git push --tags
2940
github_changelog_generator
3041
git tag -d $TAG
3142
git push --delete origin $TAG
3243

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

3848

39-
# commit files
49+
# export unitypackage
50+
PACKAGE_SRC=`node -pe 'require("./package.json").src'`
51+
echo -e "\n>> Export unitypackage... ${PACKAGE_SRC}"
52+
"$UNITY_EDITOR" -quit -batchmode -projectPath "`pwd`" -exportpackage "$PACKAGE_SRC" "$PACKAGE_NAME.unitypackage"
53+
echo -e ">> OK"
54+
55+
56+
# commit release files
57+
echo -e "\n>> Commit release files..."
4058
git add CHANGELOG.md -f
4159
git add package.json -f
4260
git commit -m "update change log"
4361

4462

4563
# merge and push
64+
echo -e "\n>> Merge and push..."
4665
git checkout master
4766
git merge --no-ff release -m "release $TAG"
4867
git branch -D release
4968
git push origin master
69+
git checkout develop
70+
git merge --ff master
71+
git push origin develop
5072

5173

52-
# export .unitypackage and release on Github
53-
PACKAGE_SRC=`node -pe 'require("./package.json").src'`
54-
$UNITY_PATH -quit -batchmode -projectPath "`pwd`" -exportpackage $PACKAGE_SRC $PACKAGE_NAME.unitypackage
55-
gh-release --draft --assets $PACKAGE_NAME.unitypackage
74+
# upload unitypackage and release on Github
75+
gh-release --assets "$PACKAGE_NAME.unitypackage"
5676

5777

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

0 commit comments

Comments
 (0)