title: Automatically building and deploying React Native app using Jenkins?
body: <p>Packaging my little react native app for Android so that it runs e.g. with <a href="https://github.com/expo/expo" rel="nofollow noreferrer">Expo</a> on an online App testing service like <a href="https://appetize.io/" rel="nofollow noreferrer">Appetize</a> or <a href="http://www.runthatapp.com/" rel="nofollow noreferrer">Runthatapp</a> is easy. Up to now I relied on online services to do the building for me, but that is no sustainable solution, that's why I want to do it on my own now.</p>
  
  <p>I understand that for compiling my react native app for iOS I have to somehow run Xcode (on a virtual box). I am able use <a href="https://developer.android.com/studio/" rel="nofollow noreferrer">Android Studio</a> to build my APK files using the GUI, but how do I do that automatically?</p>
  
  <p>I am looking for a way how to automatize that process using Jenkins (either under Ubuntu or under Windows). How would I approach that? My architectural idea looks as follows:</p>
  
  <ul>
  <li><strong>Step 1.</strong> Jenkins pulls source code and additional artwork (i.e. logos) from GIT</li>
  <li><strong>Step 2.</strong> Building and packaging.
  
  <ul>
  <li><strong>2.1</strong> Jenkins initiates the Android Studio and starts building the <code>.apk</code>-file, ideally via command line.</li>
  <li><strong>2.2</strong> Jenkins initiates Xcode with some fancy long command line, and out comes 
  a nice <code>.ipa</code> file.</li>
  </ul></li>
  <li><strong>Step 3.</strong> Jenkins takes both files and archives them</li>
  <li><strong>Step 4.</strong> Deployment
  
  <ul>
  <li><strong>4.1</strong> Jenkins automatically deploys to Google Play Store using their API</li>
  <li><strong>4.2</strong> Jenkins automatically deploys to Apple App Store using their API</li>
  <li><strong>4.3</strong> Jenkins automatically deploys it to the Amazon App Store.</li>
  </ul></li>
  </ul>
  
  <p>I am struggling with step 2 and 4, but the priority is the automatic building (step 2). Any help is appreciated, even links to tutorials. What I am after is an explanation on who to steer Android Studio and Xcode by command line. </p>
  
  <p><strong>Resources</strong></p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/6871652/how-to-run-apk-file-online">How to run apk file online?</a></li>
  <li><a href="https://stackoverflow.com/questions/35898723/">What is the (file) format of iOS/iPhone apps?</a> </li>
  <li><a href="https://stackoverflow.com/questions/15153708/deploy-to-google-play-store-via-api">Deploy to Google Play Store via API</a></li>
  <li><a href="https://stackoverflow.com/questions/31019871/automatic-app-deployment-to-amazon-store">Automatic app deployment to Amazon store</a></li>
  <li><a href="https://stackoverflow.com/questions/57107024/is-there-any-official-way-or-api-to-get-app-reviews-for-ios-apps">https://stackoverflow.com/questions/57107024/is-there-any-official-way-or-api-to-get-app-reviews-for-ios-apps</a></li>
  <li><a href="https://stackoverflow.com/questions/32783344/deploy-publish-android-app-made-with-react-native">Deploy/Publish Android app made with React Native</a></li>
  <li><a href="https://stackoverflow.com/questions/53940596/">Unable to build APK file on Jenkins (react native)</a></li>
  </ul>