Skip to content

Instantly share code, notes, and snippets.

@rutvikbhatt9
Created February 11, 2019 05:53
Show Gist options
  • Save rutvikbhatt9/92c1b9887188bcff671807869e5045ca to your computer and use it in GitHub Desktop.
Save rutvikbhatt9/92c1b9887188bcff671807869e5045ca to your computer and use it in GitHub Desktop.
.gitlab.ci.yml file for React-Native
image: openjdk:8-jdk #Defining the Docker Image
variables:
ANDROID_COMPILE_SDK: "28" #set compile SDK version
ANDROID_BUILD_TOOLS: "28.0.2" #set build tool version
ANDROID_SDK_TOOLS: "4333796" #set SDK tool build number you can find yous here https://developer.android.com/studio/releases/sdk-tools
before_script:
# Fetch the specified SDK tools version to build with
- wget --quiet --output-document=/tmp/sdk-tools-linux.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
- unzip /tmp/sdk-tools-linux.zip -d .android
# Set up environment variables
- export ANDROID_HOME=$PWD/.android
- export PATH=$PATH:$PWD/.android/platform-tools/
# Install platform tools and Android SDK for the compile target
- echo y | .android/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}"
- curl -sL https://deb.nodesource.com/setup_10.x | bash #Add Node Repo
- apt-get install -y nodejs #Install NOde JS
- npm install -g react-native-cli #Install React-Native CLI
- npm install #Install npm packages
- react-native link #Link the resources
- chmod +x android/gradlew #Provide permission for execution
# Define stages
stages:
- build_release_android
build_release_android:
stage: build_release_android
script:
- mkdir /PlayJson #make temp directory named PlayJson in root of project
- "echo $PLAY_STORE_JSON > /PlayJson/play-store-key.json" # copy git variable value to play-store-key.json file
- npm run android-bundle # bundle the app (Execute from package.json's script block)
- npm run android-release #create release app (Execute from package.json's script block)
- cd android && ./gradlew publishApkRelease # navigate to android dir & publish app on play store
only:
- master #set trigger for CICD if push or merge in master branch
artifacts:
paths:
- ./android/app/build/outputs/ # set artifact path which store your APK file
@khuongphp
Copy link

@usama-asfar ooh I see.
I think you are working with jenkin or circle CI but not gitlab ci :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment