PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, October 9, 2022

[FIXED] How to build a REACT Native app automatically using GitLab

 October 09, 2022     android, apk, continuous-integration, ios, react-native     No comments   

Issue

I am looking for a way to build the APK of my React Native App automatically using a GitLab pipeline, I can't seem to find a solution on the web that does not use Expo, do you have any ideas on how to do this?

We have a team of testers who would like to test the APK on a real device, do you have any idea on how to achieve this (without Expo)?


Solution

Hey I've successfully automated react native build apps using gitlab CI/CD pipelines. You need to create ".gitlab-ci.yml" file in the root of your project and add below scripts and may change as per your needs.

before_script:
  - yarn install --frozen-lockfile #--frozen-lockfile to make sure we will have the same packages version

stages:
  - build

build project:
  stage: build
  image: reactnativecommunity/react-native-android
  cache:
    key:
      files:
        - yarn.lock
    paths:
      - node_modules
    policy: pull #`pull` the jobs pull the cache at the beginning but do not push the changes again.
  script:
    - yarn build:apk # is the scripts defined in your package.json as "cd android #&& ./gradlew assembleRelease"
    - yarn install --pure-lockfile --cache-folder .yarn
    
  artifacts:
    paths:
      - android/app/build/outputs/apk/release/app-release.apk

let me know if you have any problems



Answered By - Ujjwal Manandhar
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing