android

scripts/android/builder.sh

  1. #!/bin/bash
  2. set -e
  3. cur_dir=`dirname $0`
  4. echo "BUILDING ANDROID";
  5. cd $cur_dir/../../android &&
  6. ./gradlew clean assembleRelease -PBUILD_NAME=$BUILD_NAME -PBUILD_NUMBER=$BUILD_NUMBER -PANDROID_APP_ID=$ANDROID_APP_ID -PMYAPP_RELEASE_STORE_FILE=$ANDROID_KEYSTORE_FILE -PMYAPP_RELEASE_KEY_ALIAS=$ANDROID_KEY_ALIAS -PMYAPP_RELEASE_STORE_PASSWORD=$ANDROID_KEYSTORE_PASSWORD -PMYAPP_RELEASE_KEY_PASSWORD=$ANDROID_KEY_PASSWORD && cd ..
  7. echo "APK will be present at android/app/build/outputs/apk/app-release.apk"

android/app/build.gradle

  1. ...
  2. def enableProguardInReleaseBuilds = false
  3. ...
  4. ...
  5. def appID = System.getenv("ANDROID_APP_ID") ?: "com.notetaker"
  6. def vCode = System.getenv("BUILD_NUMBER") ?: "0"
  7. def vName = System.getenv("BUILD_NAME") ?: "1.0.local"
  8. android {
  9. compileSdkVersion 23
  10. buildToolsVersion "23.0.1"
  11. defaultConfig {
  12. applicationId appID
  13. minSdkVersion 16
  14. targetSdkVersion 22
  15. versionCode Integer.parseInt(vCode)
  16. versionName vName
  17. ndk {
  18. abiFilters "armeabi-v7a", "x86"
  19. }
  20. }
  21. ...
  22. ...
  23. ...
  24. signingConfigs {
  25. release {
  26. if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
  27. storeFile file(MYAPP_RELEASE_STORE_FILE)
  28. storePassword MYAPP_RELEASE_STORE_PASSWORD
  29. keyAlias MYAPP_RELEASE_KEY_ALIAS
  30. keyPassword MYAPP_RELEASE_KEY_PASSWORD
  31. }
  32. }
  33. }
  34. buildTypes {
  35. release {
  36. minifyEnabled enableProguardInReleaseBuilds
  37. proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
  38. signingConfig signingConfigs.release
  39. }
  40. }
  41. ...
  42. ...
  43. ...

iOS

https://www.reactnative.guide/11-devops/11.2-ios-build-setup.html

taget: release ipa file

  • BUILD_NAME - The name that will be used by testers to identify the build, for example: ‘1.1.1’, ‘1.0-alpha’, etc.
  • BUILD_NUMBER - A unique integer number identifying the build. This is used by iOS to identify which build is the updated build. This should be an integer number. For example: 1, 111, 111, etc.
  • IOS_APP_ID - This is the unique app identifier which is used to identify the app uniquely in the App Store or it can be used to identify if the build is dev, preprod or prod. App ids may look like this: com.app.notetaker-dev, com.app.notetaker-alpha.
  • IOS_CERTIFICATE - This is the certificate file used to sign the app.
  • IOS_CERTIFICATE_KEY - This is the password used while creating the certificate.
  • IOS_PROVISION_PROFILE - This is the provision profile needed to build the app. This file mentions the capabilities/devices that are allowed to run the app.
  • IOS_EXPORT_OPTIONS_PLIST - This is the options file needed to specify parameters for the build.
  • IOS_SCHEME - The scheme which should be used to build the IPA. Typically, we will have different schemes per environment. For example, we can have a local, a preprod and a production scheme.
  • IOS_CONFIGURATION - This is the setting which specifies if the build is DEBUG or RELEASE.
  • PROJECT_NAME - This is the name of the project. For example, if your project name inside ios folder says SampleProject.xcworkspace or SampleProject.xcodeproj, then PROJECT_NAME=SampleProject .

certificates and provisioning profiles

Archiving the project

Exporting the IPA

  1. IOS_SCHEME='vibraexpo' IOS_CONFIGURATION='RELEASE' IOS_EXPORT_OPTIONS_PLIST='exportOptions-dev.plist' sh ./scripts/ios/build.sh

第一步 打包

  • 选择 schema
  • 选择证书
  • 选择描述文件

第二步 导出

appcenter-cli

https://github.com/Microsoft/appcenter-cli