Commit 1a0c5818 authored by jayed nahian's avatar jayed nahian
Browse files

fix-44

parent 2ccfd8d0
Pipeline #8116 failed with stage
in 1 minute and 17 seconds
...@@ -30,25 +30,50 @@ deploy_job: ...@@ -30,25 +30,50 @@ deploy_job:
variables: variables:
SECURE_FILES_DOWNLOAD_PATH: './android/' SECURE_FILES_DOWNLOAD_PATH: './android/'
VERSION_NAME: '4.4.2' VERSION_NAME: '4.4.2'
APK_NAME_PREFIX: 'testApp' APK_NAME_PREFIX: 'testApp_01'
APK_NAME: $APK_NAME_PREFIX'_'$VERSION_NAME'_'$(date '+%d%B') APK_NAME: $APK_NAME_PREFIX'_'$VERSION_NAME'_'$(date '+%d%B')
script: script:
# -----------------------
# Setup SSH
# -----------------------
- mkdir -p ~/.ssh
- echo "$SSH_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
# Start SSH Agent and add password-protected key
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/id_rsa <<< "$SSH_PASSPHRASE"
# Add host to known_hosts
- ssh-keyscan -p $SSH_PORT $SERVER_IP >> ~/.ssh/known_hosts
- curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash - curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash
# -----------------------
# Build APK
# -----------------------
- export JAVA_HOME=$(/usr/libexec/java_home -v 17) - export JAVA_HOME=$(/usr/libexec/java_home -v 17)
- npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/ - npx react-native bundle --platform android --dev false --entry-file index.js \
--bundle-output android/app/src/main/assets/index.android.bundle \
--assets-dest android/app/src/main/res/
- cd android - cd android
- rm -rf ./app/src/main/res/**/node_modules_* ./app/src/main/res/**/app_assets* ./app/src/main/res/**/assets* ./app/src/main/res/**/app* - rm -rf ./app/src/main/res/**/node_modules_* ./app/src/main/res/**/app_assets* ./app/src/main/res/**/assets* ./app/src/main/res/**/app*
- rm -rf ./.gradle/6.8.3/executionHistory/executionHistory.lock - rm -rf ./.gradle/6.8.3/executionHistory/executionHistory.lock
- echo "sdk.dir=/Users/tltestuser/Library/Android/sdk" > local.properties - echo "sdk.dir=/Users/tltestuser/Library/Android/sdk" > local.properties
- ./gradlew assembleRelease - ./gradlew assembleRelease
# List all APKs to verify location
# -----------------------
# Find & Rename APK
# -----------------------
- find ./app/build/outputs/apk -type f -name "*.apk" - find ./app/build/outputs/apk -type f -name "*.apk"
# Store APK path in variable
- APK_DIR="./app/build/outputs/apk/release" - APK_DIR="./app/build/outputs/apk/release"
- cd $APK_DIR - cd $APK_DIR
# Rename and copy - mv app-release.apk "$APK_NAME_PREFIX"_"$VERSION_NAME"_$(date '+%d%B').apk
- mv app-release.apk $APK_NAME_PREFIX"_"$VERSION_NAME"_"$(date '+%d%B').apk
- scp -i /Users/tltestuser/Downloads/ndot_key_14012025 -P 3716 *.apk custodian@n.trucklagbe.com:/var/www/n.trucklagbe.com/html/APK/QO/ # -----------------------
# Secure Upload (SCP)
# -----------------------
- scp -P $SSH_PORT *.apk $SSH_USER@$SERVER_IP:/var/www/n.trucklagbe.com/html/APK/QO/
# - scp -i /Users/tltestuser/Downloads/ndot_key_14012025 -P 3716 *.apk custodian@n.trucklagbe.com:/var/www/n.trucklagbe.com/html/APK/QO/
except: except:
- pushes - pushes
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment