Update .gitlab-ci.yml file
This commit is contained in:
@@ -53,17 +53,21 @@ assembleRelease:
|
|||||||
- |
|
- |
|
||||||
if [[ "$CI_COMMIT_TAG" =~ release ]]; then
|
if [[ "$CI_COMMIT_TAG" =~ release ]]; then
|
||||||
echo "Decoding keystore file from Base64"
|
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
|
# 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
|
# 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
|
# 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
|
if echo "$CLEANED_KEYSTORE" | base64 -d > "$CI_PROJECT_DIR/app/keystore.jks" 2>/tmp/base64_error; then
|
||||||
@@ -71,12 +75,15 @@ assembleRelease:
|
|||||||
else
|
else
|
||||||
echo "Error decoding keystore file:"
|
echo "Error decoding keystore file:"
|
||||||
cat /tmp/base64_error
|
cat /tmp/base64_error
|
||||||
|
echo "First 20 characters of cleaned content: ${CLEANED_KEYSTORE:0:20}..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the keystore file was created and has content
|
# Check if the keystore file was created and has content
|
||||||
if [ -s "$CI_PROJECT_DIR/app/keystore.jks" ]; then
|
if [ -s "$CI_PROJECT_DIR/app/keystore.jks" ]; then
|
||||||
echo "Keystore file created successfully"
|
echo "Keystore file created successfully"
|
||||||
|
# Print file size for verification
|
||||||
|
ls -l "$CI_PROJECT_DIR/app/keystore.jks"
|
||||||
else
|
else
|
||||||
echo "Error: Keystore file is empty or not created"
|
echo "Error: Keystore file is empty or not created"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user