8 read -p "$prompt_text [$default_value]: " tmp
9 if [ "$tmp" = "" ]; then
10 echo "$default_value"; return
11 elif echo "$tmp" | grep -q -E '^[0-9]+$'; then
17 # On a release the following actions are performed
18 # * DEVELOPMENT_BUILD is set to false
19 # * android versionCode is bumped
20 # * Commit the changes
21 # * Tag with current version
23 sed -i -re "s/^set\(DEVELOPMENT_BUILD TRUE\)$/set(DEVELOPMENT_BUILD FALSE)/" CMakeLists.txt
25 sed -i -re "s/versionCode [0-9]+$/versionCode $NEW_ANDROID_VERSION_CODE/" build/android/build.gradle
27 git add -f CMakeLists.txt build/android/build.gradle
29 git commit -m "Bump version to $RELEASE_VERSION"
31 echo "Tagging $RELEASE_VERSION"
33 git tag -a "$RELEASE_VERSION" -m "$RELEASE_VERSION"
37 # * Set DEVELOPMENT_BUILD to true
38 # * Bump version in CMakeLists and docs
39 # * Commit the changes
41 echo 'Creating "return back to development" commit'
43 sed -i -re 's/^set\(DEVELOPMENT_BUILD FALSE\)$/set(DEVELOPMENT_BUILD TRUE)/' CMakeLists.txt
45 sed -i -re "s/^set\(VERSION_MAJOR [0-9]+\)$/set(VERSION_MAJOR $NEXT_VERSION_MAJOR)/" CMakeLists.txt
47 sed -i -re "s/^set\(VERSION_MINOR [0-9]+\)$/set(VERSION_MINOR $NEXT_VERSION_MINOR)/" CMakeLists.txt
49 sed -i -re "s/^set\(VERSION_PATCH [0-9]+\)$/set(VERSION_PATCH $NEXT_VERSION_PATCH)/" CMakeLists.txt
51 sed -i -re "1s/[0-9]+\.[0-9]+\.[0-9]+/$NEXT_VERSION/g" doc/menu_lua_api.txt
53 sed -i -re "1s/[0-9]+\.[0-9]+\.[0-9]+/$NEXT_VERSION/g" doc/client_lua_api.md
55 git add -f CMakeLists.txt doc/menu_lua_api.txt doc/client_lua_api.md
57 git commit -m "Continue with $NEXT_VERSION-dev"
59 ##################################
60 # Switch to top minetest directory
61 ##################################
66 #######################
67 # Determine old version
68 #######################
70 # Make sure all the files we need exist
71 grep -q -E '^set\(VERSION_MAJOR [0-9]+\)$' CMakeLists.txt
72 grep -q -E '^set\(VERSION_MINOR [0-9]+\)$' CMakeLists.txt
73 grep -q -E '^set\(VERSION_PATCH [0-9]+\)$' CMakeLists.txt
74 grep -q -E 'versionCode [0-9]+$' build/android/build.gradle
76 VERSION_MAJOR=$(grep -E '^set\(VERSION_MAJOR [0-9]+\)$' CMakeLists.txt | tr -dC 0-9)
77 VERSION_MINOR=$(grep -E '^set\(VERSION_MINOR [0-9]+\)$' CMakeLists.txt | tr -dC 0-9)
78 VERSION_PATCH=$(grep -E '^set\(VERSION_PATCH [0-9]+\)$' CMakeLists.txt | tr -dC 0-9)
79 ANDROID_VERSION_CODE=$(grep -E 'versionCode [0-9]+$' build/android/build.gradle | tr -dC 0-9)
81 RELEASE_VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"
83 echo "Current Minetest version: $RELEASE_VERSION"
84 echo "Current Android version code: $ANDROID_VERSION_CODE"
86 NEW_ANDROID_VERSION_CODE=$(expr $ANDROID_VERSION_CODE + 1)
87 NEW_ANDROID_VERSION_CODE=$(prompt_for_number "Set android version code" $NEW_ANDROID_VERSION_CODE)
90 echo "New android version code: $NEW_ANDROID_VERSION_CODE"
92 ########################
94 ########################
98 ########################
99 # Prompt for next version
100 ########################
102 NEXT_VERSION_MAJOR=$VERSION_MAJOR
103 NEXT_VERSION_MINOR=$VERSION_MINOR
104 NEXT_VERSION_PATCH=$(expr $VERSION_PATCH + 1)
106 NEXT_VERSION_MAJOR=$(prompt_for_number "Set next major" $NEXT_VERSION_MAJOR)
108 if [ "$NEXT_VERSION_MAJOR" != "$VERSION_MAJOR" ]; then
113 NEXT_VERSION_MINOR=$(prompt_for_number "Set next minor" $NEXT_VERSION_MINOR)
115 if [ "$NEXT_VERSION_MINOR" != "$VERSION_MINOR" ]; then
119 NEXT_VERSION_PATCH=$(prompt_for_number "Set next patch" $NEXT_VERSION_PATCH)
121 NEXT_VERSION="$NEXT_VERSION_MAJOR.$NEXT_VERSION_MINOR.$NEXT_VERSION_PATCH"
124 echo "New version: $NEXT_VERSION"
126 ########################
127 # Return back to devel
128 ########################