Gitlab ci with react native Android for various env

Hi,
so this is my package.json script
“android:staging”: “react-native run-android --variant=stagingdebug”,
“android:staging-release”: “react-native run-android --variant=stagingrelease”,
“android:dev”: “react-native run-android --variant=devdebug”,
“android:dev-release”: “react-native run-android --variant=devrelease”,
“android:development”: “react-native run-android --variant=developmentdebug”,
“android:production-release”: “react-native run-android --variant=productionrelease”,
“android:production-debug”: “react-native run-android --variant=productiondebug”,

to work on CI in my project I have written the gitlab-ci.yml as follows:

image: reactnativecommunity/react-native-android

before_script:

  • export ANDROID_SDK_ROOT=$ANDROID_HOME
  • export GRADLE_USER_HOME=$(pwd)/.gradle
  • npm i jetifier
  • npx jetify
  • npx envinfo
  • npm install

stages:

  • build
  • deploy

build:
stage: build
script:
- echo $CI_COMMIT_TAG
- cd android && chmod +x gradlew
- ./gradlew clean
- cd …
- npx react-native run-android --variant=stagingrelease
- exit_status=$? # Capture the exit status of the command
- if [ $exit_status -eq 0 ]; then echo “Device connected”; else echo “No device connected”; fi # Print a message based on the exit status

when: manual

artifacts:
paths:
- android/app/build/outputs/

Can anyone please help me with the changes I need to make because this is giving me an error: No device connected!!

This is the error:
FAILURE: Build failed with an exception.
BUILD FAILED in 19m 17s

2149 at /builds/xyz2960913/runnerapp/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
2152 at async Command.handleAction (/builds/xyz2960913/runnerapp/node_modules/@react-native-community/cli/build/index.js:192:9)

2153info Run CLI with --verbose flag for more details.