Update .gitlab-ci.yml file

This commit is contained in:
Chandrashekhar Reddy
2024-10-15 12:58:55 +00:00
parent 2637f84cac
commit 35614e082f

View File

@@ -53,12 +53,41 @@ assembleRelease:
- |
if [[ "$CI_COMMIT_TAG" =~ release ]]; then
echo "Decoding keystore file from Base64"
echo $BASE64_KEYSTORE | base64 --decode > $CI_PROJECT_DIR/app/keystore.jks
# Debug: Check if BASE64_KEYSTORE is set
if [ -z "$BASE64_KEYSTORE" ]; then
echo "Error: BASE64_KEYSTORE is not set"
exit 1
fi
# Debug: Print the first few characters of BASE64_KEYSTORE
echo "First 10 characters of BASE64_KEYSTORE: ${BASE64_KEYSTORE:0:10}..."
# Remove any potential whitespace or newline characters
CLEANED_KEYSTORE=$(echo "$BASE64_KEYSTORE" | tr -d '[:space:]')
# Attempt to decode and save to a file
if echo "$CLEANED_KEYSTORE" | base64 -d > "$CI_PROJECT_DIR/app/keystore.jks" 2>/tmp/base64_error; then
echo "Keystore file decoded successfully"
else
echo "Error decoding keystore file:"
cat /tmp/base64_error
exit 1
fi
# Check if the keystore file was created and has content
if [ -s "$CI_PROJECT_DIR/app/keystore.jks" ]; then
echo "Keystore file created successfully"
else
echo "Error: Keystore file is empty or not created"
exit 1
fi
echo "Building signed release APK"
./gradlew assembleRelease -Pandroid.injected.signing.store.file=$CI_PROJECT_DIR/app/keystore.jks \
-Pandroid.injected.signing.store.password=$KEYSTORE_PASSWORD \
-Pandroid.injected.signing.key.alias=$KEY_ALIAS \
-Pandroid.injected.signing.key.password=$KEY_PASSWORD
./gradlew assembleRelease \
-Pandroid.injected.signing.store.file="$CI_PROJECT_DIR/app/keystore.jks" \
-Pandroid.injected.signing.store.password="$KEYSTORE_PASSWORD" \
-Pandroid.injected.signing.key.alias="$KEY_ALIAS" \
-Pandroid.injected.signing.key.password="$KEY_PASSWORD"
else
echo "Tag '$CI_COMMIT_TAG' does not contain 'release'. Skipping release build."
fi
@@ -66,6 +95,8 @@ assembleRelease:
paths:
- app/build/outputs/
expire_in: never
rules:
- if: $CI_COMMIT_TAG =~ /release/
debugTests:
needs: [lintDebug, assembleDebug]