如何使用 GitLab 自动构建 REACT Native 应用程序

问题描述 投票:0回答:2

我正在寻找一种使用 GitLab 管道自动构建 React Native 应用程序的 APK 的方法,我似乎无法在网络上找到不使用 Expo 的解决方案,您对如何执行此操作有任何想法吗?

我们有一个测试人员团队想要在真实设备上测试APK,您知道如何实现这一点(没有Expo)吗?

android ios react-native continuous-integration apk
2个回答
5
投票

嘿,我已经使用 gitlab CI/CD 管道成功自动化了 React Native 构建应用程序。 您需要在项目的根目录中创建“.gitlab-ci.yml”文件e 并添加以下脚本并且可能会根据您的需要进行更改

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

如果您有任何问题请告诉我


0
投票

在我的 React Native 项目中,我想使用 GitLab CI 自动为每个合并请求运行 lint 检查和测试。之后,我想为我承诺的分支生成一个 APK,并将其发送给 Slack 上的特定人员。这可能吗?

© www.soinside.com 2019 - 2024. All rights reserved.