You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ANDROID_VERSION_CODE=$(grep "versionCode" app/build.gradle.kts | sed 's/.*versionCode\s*=\s*\([0-9]*\).*/\1/'| awk '{print $0+0}')
5
-
if [ -z"$ANDROID_VERSION_CODE" ];then
6
-
echo"Error: Unable to extract version code."
3
+
# Check if the build.gradle.kts file exists
4
+
if [ !-f"app/build.gradle.kts" ];then
5
+
echo"Error: app/build.gradle.kts file not found."
7
6
exit 1
8
7
fi
9
8
10
-
# Extract Android version name
11
-
ANDROID_VERSION_NAME=$(grep "versionName" app/build.gradle.kts | sed "s/.*versionName\\s*=\\s*'\\(.*\\)'.*/\\1/"| tr -d '[:space:]'| sed 's/"//g'| sed 's/versionName=//')
12
-
if [ -z"$ANDROID_VERSION_NAME" ];then
13
-
echo"Error: Unable to extract version name."
14
-
exit 1
9
+
# Check if EXPOSE_CODE is true for extracting Android version code
10
+
if [ "$EXPOSE_CODE"='true' ];then
11
+
# Extract Android version code as string
12
+
ANDROID_VERSION_CODE=$(grep "versionCode" app/build.gradle.kts | sed 's/.*versionCode\s*=\s*\([0-9]*\).*/\1/'| awk '{print $0+0}')
13
+
if [ -z"$ANDROID_VERSION_CODE" ];then
14
+
echo"Error: Unable to extract version code."
15
+
exit 1
16
+
fi
17
+
18
+
# Write the extracted Android version code to a temporary file
# Check if EXPOSE_NAME is true for extracting version name
23
+
if [ "$EXPOSE_NAME"='true' ];then
24
+
# Extract Android version name
25
+
ANDROID_VERSION_NAME=$(grep "versionName" app/build.gradle.kts | sed "s/.*versionName\\s*=\\s*'\\(.*\\)'.*/\\1/"| tr -d '[:space:]'| sed 's/"//g'| sed 's/versionName=//')
26
+
if [ -z"$ANDROID_VERSION_NAME" ];then
27
+
echo"Error: Unable to extract version name."
28
+
exit 1
29
+
fi
20
30
21
-
# Debugging output to indicate script completion
22
-
echo"Script execution complete."
31
+
# Append the extracted Android version name to the temporary file
0 commit comments