Add build automation and CI publishing workflow
Some checks failed
Android CI / build (push) Has been cancelled
Some checks failed
Android CI / build (push) Has been cancelled
This commit is contained in:
18
scripts/bump_version.sh
Executable file
18
scripts/bump_version.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
BUILD_FILE="$ROOT_DIR/android/app/build.gradle.kts"
|
||||
|
||||
current_code="$(grep -E 'versionCode = [0-9]+' "$BUILD_FILE" | head -n1 | sed -E 's/.*versionCode = ([0-9]+)/\1/')"
|
||||
current_name="$(grep -E 'versionName = "[0-9]+\.[0-9]+\.[0-9]+"' "$BUILD_FILE" | head -n1 | sed -E 's/.*versionName = "([0-9]+\.[0-9]+\.[0-9]+)"/\1/')"
|
||||
|
||||
IFS='.' read -r major minor patch <<< "$current_name"
|
||||
new_code=$((current_code + 1))
|
||||
new_patch=$((patch + 1))
|
||||
new_name="${major}.${minor}.${new_patch}"
|
||||
|
||||
sed -i -E "s/versionCode = [0-9]+/versionCode = ${new_code}/" "$BUILD_FILE"
|
||||
sed -i -E "s/versionName = \"[0-9]+\.[0-9]+\.[0-9]+\"/versionName = \"${new_name}\"/" "$BUILD_FILE"
|
||||
|
||||
echo "Version bumped to ${new_name} (${new_code})"
|
||||
Reference in New Issue
Block a user