summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4c0fc8f)
raw | patch | inline | side by side (parent: 4c0fc8f)
author | fredboy <fredboy@protonmail.com> | |
Tue, 16 Apr 2024 19:56:39 +0000 (02:56 +0700) | ||
committer | fredboy <fredboy@protonmail.com> | |
Tue, 16 Apr 2024 20:06:47 +0000 (03:06 +0700) |
.gitignore | patch | blob | history | |
gen-changelog.sh | [new file with mode: 0755] | patch | blob |
make-release.sh | [new file with mode: 0755] | patch | blob |
up-version.sh | [new file with mode: 0755] | patch | blob |
diff --git a/.gitignore b/.gitignore
index ac624d207dbf4971a19c34d50b5b78ea187c9358..c83f78b4ffd5af2bd48e8f05d719903386ff5a79 100644 (file)
--- a/.gitignore
+++ b/.gitignore
!/ios-moe/xcode/*.xcodeproj/xcshareddata
!/ios-moe/xcode/*.xcodeproj/project.pbxproj
/ios-moe/xcode/native/
+
+release-*/
\ No newline at end of file
diff --git a/gen-changelog.sh b/gen-changelog.sh
--- /dev/null
+++ b/gen-changelog.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+previous_tag=0
+i=0
+for current_tag in $(git tag --sort=-creatordate)
+do
+
+if [ "$previous_tag" != 0 ] && [ $i -lt 1 ]; then
+ i=$(echo "$i + 1" | bc -q )
+ tag_date=$(git log -1 --pretty=format:'%ad' --date=short ${previous_tag})
+ printf "## ${previous_tag} (${tag_date})\n\n"
+ git log ${current_tag}...${previous_tag} --pretty=format:'* %s ' --reverse | grep -v Merge
+ printf "\n\n"
+fi
+previous_tag=${current_tag}
+done
diff --git a/make-release.sh b/make-release.sh
--- /dev/null
+++ b/make-release.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+
+require_clean_work_tree() {
+ # Update the index
+ git update-index -q --ignore-submodules --refresh
+ err=0
+
+ # Disallow unstaged changes in the working tree
+ if ! git diff-files --quiet --ignore-submodules --
+ then
+ echo >&2 "cannot $1: you have unstaged changes."
+ git diff-files --name-status -r --ignore-submodules -- >&2
+ err=1
+ fi
+
+ # Disallow uncommitted changes in the index
+ if ! git diff-index --cached --quiet HEAD --ignore-submodules --
+ then
+ echo >&2 "cannot $1: your index contains uncommitted changes."
+ git diff-index --cached --name-status -r --ignore-submodules HEAD -- >&2
+ err=1
+ fi
+
+ if [ $err = 1 ]
+ then
+ echo >&2 "Please commit or stash them."
+ exit 1
+ fi
+}
+
+
+if [[ ! $1 ]]; then
+ echo "usage: $0 versionName"
+ exit
+fi
+
+require_clean_work_tree "$0"
+
+release_dir="release-$1"
+
+mkdir "$release_dir"
+
+./up-version.sh "$1"
+./gen-changelog.sh > "$release_dir/CHANGELOG"
+
+./gradlew clean android:assembleRelease desktop:dist
+
+cp android/build/outputs/apk/release/*.apk "$release_dir/"
+cp desktop/build/libs/*.jar "$release_dir/"
+
+echo "$release_dir/"
diff --git a/up-version.sh b/up-version.sh
--- /dev/null
+++ b/up-version.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+git stash > /dev/null
+stashed=$?
+
+new_version=$1
+
+new_version_string=$(echo $new_version | sed 's/\(alpha\|beta\)\(.*\)/\1 \2/')
+
+sed -i 's/\(version\s=\s\)'"'"'.*'"'"'/\1'"'"''"$new_version"''"'"'/g' build.gradle
+sed -i 's/\(versionName\s\)\".*\"/\1\"'"$new_version"'\"/g' android/build.gradle
+sed -i 's/\(^\s*versionCode\s\)\([0-9]*\)/echo "\1$((\2+1))"/ge' android/build.gradle
+sed -i 's/\(public static final String VERSION = \)\".*\"/\1\"'"$new_version_string"'\"/' core/src/ru/deadsoftware/cavedroid/CaveGame.java
+
+git add build.gradle android/build.gradle core/src/ru/deadsoftware/cavedroid/CaveGame.java
+
+git commit -m "Update version"
+git tag "$new_version"
+
+if [ $stashed ]; then
+ git stash pop
+fi