Skip to content

Instantly share code, notes, and snippets.

@jenish-jadav
Created September 22, 2020 05:36
Show Gist options
  • Select an option

  • Save jenish-jadav/c8be9177fce357a97732f3f3d0b214e0 to your computer and use it in GitHub Desktop.

Select an option

Save jenish-jadav/c8be9177fce357a97732f3f3d0b214e0 to your computer and use it in GitHub Desktop.
React Native Bitbucket Pipeline for Android
image: node:10.15.3
pipelines:
default:
- step:
image: node:10.15.3
caches:
- node
- gradle
script:
- npm install
- npx react-native link
- step:
image: mingc/android-build-box:latest
caches:
- node
- gradle
- android-sdk
script:
- npm install
# Download and unzip android sdk
- wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
- unzip -o -qq android-sdk.zip -d android-sdk
# Define Android Home and add PATHs
- export ANDROID_HOME="/opt/atlassian/pipelines/agent/build/android-sdk"
- export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$PATH"
# Download packages.
- yes | sdkmanager "platform-tools"
- yes | sdkmanager "platforms;android-27"
- yes | sdkmanager "build-tools;27.0.3"
- yes | sdkmanager "extras;android;m2repository"
- yes | sdkmanager "extras;google;m2repository"
- yes | sdkmanager "extras;google;instantapps"
- yes | sdkmanager --licenses
# Build apk
- chmod a+x ./android/gradlew
- cd android
- ./gradlew assembleRelease
artifacts:
- app/build/outputs/*.apk
definitions:
caches:
android-sdk: android-sdk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment