Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
my-test-group
TestAppCiNew
Commits
a391acc8
Commit
a391acc8
authored
Nov 27, 2025
by
jayed nahian
Browse files
fix-77
parent
3e774976
Pipeline
#8119
failed with stage
in 2 minutes and 37 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
a391acc8
...
@@ -2,33 +2,24 @@ stages:
...
@@ -2,33 +2,24 @@ stages:
-
deploy
-
deploy
before_script
:
before_script
:
# # Load NVM and Node.js
# - export NVM_DIR="$HOME/.nvm"
# - '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"'
# - nvm use 20
# # Commands to be run before any job
# - rm -rf node_modules
# - rm -f package-lock.json
# - npm install
# Load NVM and Node.js
# Load NVM and Node.js
-
export NVM_DIR="$HOME/.nvm"
-
export NVM_DIR="$HOME/.nvm"
-
'
[
-s
"$NVM_DIR/nvm.sh"
]
&&
\.
"$NVM_DIR/nvm.sh"'
-
'
[
-s
"$NVM_DIR/nvm.sh"
]
&&
\.
"$NVM_DIR/nvm.sh"'
-
nvm use
20
-
nvm use
20
# Clean installation
-
rm -rf node_modul
es
# Clean and install dependenci
es
-
rm -
f
package-lock.json
-
rm -
rf node_modules
package-lock.json
-
npm cache clean --force
-
npm cache clean --force
-
npm install
-
npm install
# Verify React installation
# Verify React installation
-
ls -la node_modules/react/
-
ls -la node_modules/react/
-
ls -la index.js
# debug: make sure index.js exists
deploy_job
:
deploy_job
:
stage
:
deploy
stage
:
deploy
tags
:
tags
:
-
2nd
-
2nd
variables
:
variables
:
SECURE_FILES_DOWNLOAD_PATH
:
'
./android/'
VERSION_NAME
:
'
4.4.2'
VERSION_NAME
:
'
4.4.2'
APK_NAME_PREFIX
:
'
testApp_01'
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')
...
@@ -39,32 +30,36 @@ deploy_job:
...
@@ -39,32 +30,36 @@ deploy_job:
script
:
script
:
# -----------------------
# -----------------------
# Setup
SSH
# S
SH s
etup
# -----------------------
# -----------------------
-
mkdir -p ~/.ssh
-
mkdir -p ~/.ssh
-
echo "$SSH_KEY" > ~/.ssh/id_rsa
-
echo "$SSH_KEY" > ~/.ssh/id_rsa
-
chmod 600 ~/.ssh/id_rsa
-
chmod 600 ~/.ssh/id_rsa
# Start SSH Agent and add password-protected key
-
eval "$(ssh-agent -s)"
-
eval "$(ssh-agent -s)"
-
ssh-add ~/.ssh/id_rsa <<< "$SSH_PASSPHRASE"
-
ssh-add ~/.ssh/id_rsa <<< "$SSH_PASSPHRASE"
-
ssh-keyscan -H -p $SSH_PORT $SERVER_IP >> ~/.ssh/known_hosts
#
Add host to known_hosts
#
-----------------------
-
ssh-keyscan -p $SSH_PORT $SERVER_IP >> ~/.ssh/known_hosts
# Optional: download secure files if needed
# -----------------------
-
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
# 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 \
-
echo "sdk.dir=/Users/tltestuser/Library/Android/sdk" > android/local.properties
--bundle-output android/app/src/main/assets/index.android.bundle \
--assets-dest android/app/src/main/res/
# Bundle JS (make sure in project root)
-
cd $CI_PROJECT_DIR
-
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/
# Go to Android folder and clean old resources
-
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
# Build release APK
-
./gradlew assembleRelease
-
./gradlew assembleRelease
# -----------------------
# -----------------------
...
@@ -73,13 +68,12 @@ deploy_job:
...
@@ -73,13 +68,12 @@ deploy_job:
-
find ./app/build/outputs/apk -type f -name "*.apk"
-
find ./app/build/outputs/apk -type f -name "*.apk"
-
APK_DIR="./app/build/outputs/apk/release"
-
APK_DIR="./app/build/outputs/apk/release"
-
cd $APK_DIR
-
cd $APK_DIR
-
mv app-release.apk "$APK_NAME
_PREFIX"_"$VERSION_NAME"_$(date '+%d%B').apk
-
mv app-release.apk "$APK_NAME
"
# -----------------------
# -----------------------
#
Secure
Upload
(SCP)
# Upload
APK
# -----------------------
# -----------------------
-
scp -P $SSH_PORT *.apk $SSH_USER@$SERVER_IP:/var/www/n.trucklagbe.com/html/APK/QO/
-
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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment