Update .gitlab-ci.yml file
This commit is contained in:
@@ -53,12 +53,41 @@ 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"
|
||||||
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"
|
echo "Building signed release APK"
|
||||||
./gradlew assembleRelease -Pandroid.injected.signing.store.file=$CI_PROJECT_DIR/app/keystore.jks \
|
./gradlew assembleRelease \
|
||||||
-Pandroid.injected.signing.store.password=$KEYSTORE_PASSWORD \
|
-Pandroid.injected.signing.store.file="$CI_PROJECT_DIR/app/keystore.jks" \
|
||||||
-Pandroid.injected.signing.key.alias=$KEY_ALIAS \
|
-Pandroid.injected.signing.store.password="$KEYSTORE_PASSWORD" \
|
||||||
-Pandroid.injected.signing.key.password=$KEY_PASSWORD
|
-Pandroid.injected.signing.key.alias="$KEY_ALIAS" \
|
||||||
|
-Pandroid.injected.signing.key.password="$KEY_PASSWORD"
|
||||||
else
|
else
|
||||||
echo "Tag '$CI_COMMIT_TAG' does not contain 'release'. Skipping release build."
|
echo "Tag '$CI_COMMIT_TAG' does not contain 'release'. Skipping release build."
|
||||||
fi
|
fi
|
||||||
@@ -66,6 +95,8 @@ assembleRelease:
|
|||||||
paths:
|
paths:
|
||||||
- app/build/outputs/
|
- app/build/outputs/
|
||||||
expire_in: never
|
expire_in: never
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG =~ /release/
|
||||||
|
|
||||||
debugTests:
|
debugTests:
|
||||||
needs: [lintDebug, assembleDebug]
|
needs: [lintDebug, assembleDebug]
|
||||||
|
|||||||
Reference in New Issue
Block a user