Update .gitlab-ci.yml file

This commit is contained in:
Chandrashekhar Reddy
2024-10-15 13:05:29 +00:00
parent 35614e082f
commit d1a6231716

View File

@@ -53,17 +53,21 @@ assembleRelease:
- |
if [[ "$CI_COMMIT_TAG" =~ release ]]; then
echo "Decoding keystore file from Base64"
# 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}..."
echo "First 20 characters of BASE64_KEYSTORE: ${BASE64_KEYSTORE:0:20}..."
# Check if BASE64_KEYSTORE is a file path
if [[ "$BASE64_KEYSTORE" == /* ]] && [[ -f "$BASE64_KEYSTORE" ]]; then
echo "BASE64_KEYSTORE appears to be a file path. Reading content..."
BASE64_CONTENT=$(cat "$BASE64_KEYSTORE")
else
echo "BASE64_KEYSTORE is not a file path. Using as-is."
BASE64_CONTENT="$BASE64_KEYSTORE"
fi
# Remove any potential whitespace or newline characters
CLEANED_KEYSTORE=$(echo "$BASE64_KEYSTORE" | tr -d '[:space:]')
CLEANED_KEYSTORE=$(echo "$BASE64_CONTENT" | 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
@@ -71,12 +75,15 @@ assembleRelease:
else
echo "Error decoding keystore file:"
cat /tmp/base64_error
echo "First 20 characters of cleaned content: ${CLEANED_KEYSTORE:0:20}..."
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"
# Print file size for verification
ls -l "$CI_PROJECT_DIR/app/keystore.jks"
else
echo "Error: Keystore file is empty or not created"
exit 1