deploy: android: stage: deploy tags: - rnbuild before_script: - npm install script: - cd android &. Osx control which version of node xcode uses for react native builds manual#Specifying when: manual will help you optimize ressources if that's a concern, so your build machine will only work when needed by the team. cp android/app/build/outputs/apk/app-release.apk $CI_PROJECT_NAME-$CI_COMMIT_REF_NAME.apk artifacts: name: "$CI_PROJECT_NAME-$PLATFORM-$CI_COMMIT_REF_NAME" paths: - $CI_PROJECT_NAME-$CI_COMMIT_REF_NAME.apk expire_in: 7 days We can use a combination of variables given by the runner such as $CI_PROJECT_NAME and $CI_COMMIT_REF_NAME to name our build file. We use the artifacts anchor for this end purpose. Once the runner will create the build, we need to find it within the android folder and upload it back to Gitlab. gradlew assembleRelease -PMYAPP_RELEASE_STORE_PASSWORD=$KEYSTORE_PASSWORD -PMYAPP_RELEASE_KEY_PASSWORD=$KEYSTORE_PASSWORD Osx control which version of node xcode uses for react native builds password#We then apply the usual build commands and use environment variables to pass our keystore password to the build script. deploy: android: stage: deploy tags: - rnbuild before_script: - npm install We need to tell the gitlab runner to install our npm packages before running anything else. Let's define a variable for the password and call it KEYSTORE_PASSWORD. Gitlab explicitely offers variables that you can pass to your runners. You generally don't want to push that to your repository. #Automating the Android buildįirst things first, we need to find a way to pass our password for the keystore, in order to get a digitally signed build. To keep it simple, we can start with Android. The CI script uses the YAML markup language, make sure you get familiar with the syntax before diving head on in the code.īuilding on Android or iOS will require different steps, so let's define a job for each. In order to keep this article focused, we will only pay attention to the deploy stage, and work our script around that. Jobs within a CI configuration can belong to three different default stages : build, test and deploy. You can set up a tag to uniquely identify the runner that help you target this specific environment in your YAML file. Once the environment is ready, simply install Gitlab Runner, register it with the token provided by Gitlab and run the daemon. For this specific article, we will be installing our Runner on a macOS machine. For our React Native needs, the Runner needs to be executed in an environment hosting Android SDKs, Xcode and Node. It can run your jobs encapsulated in a docker image or simply in the shell of a targeted machine. gitlab-ci.yml file to your projectĮssentially, a Runner will be used to run your jobs in any kind of environment you install it onto, and send the results back to Gitlab. There are only 2 steps needed to have a working CI system: In this article we will tackle the steps needed to implement continuous integration to your React Native apps in Gitlab, and help you maintain momentum in your team by offering constant availability of your builds for testing, demo and release purposes. Besides powerful version control and project management, the Gitlab ecosystem also integrates tools such as Gitlab CI, that allows developers to streamline and optimize the testing and deployment stages of your app development lifecycle.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |