Bitbucket Pipelines - React Native
March 3, 2021
Ziel
React Native Android Build in Bitbucket Pipelines automatisieren.
Minimaler Ansatz
- Node + JDK + Android SDK
- npm/yarn cache
- Keystore als Secret
Beispiel Pipeline (vereinfacht)
code
image: ubuntu:22.04
pipelines:
default:
- step:
name: Build Android
caches:
- node
script:
- apt-get update -qq
- apt-get install -qq curl unzip openjdk-17-jdk
- curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
- apt-get install -qq nodejs
- npm ci
- cd android
- ./gradlew bundleRelease
artifacts:
- android/app/build/outputs/**
Keystore Handling
Keystore als Base64 in Bitbucket Secrets:
code
echo "$KEYSTORE_BASE64" | base64 --decode > keystore.jks
Dann in gradle.properties oder via ENV:
code
export MYAPP_UPLOAD_STORE_FILE=keystore.jks
Tipps
- Nutze ein eigenes Docker Image, um Setup Zeit zu sparen
- Cache fuer
~/.gradleaktivieren - Gradle Daemon in CI oft deaktivieren (
--no-daemon)