Code Monkey home page Code Monkey logo

tqt-mobile-starter-kit's Introduction

tqt-mobile-starter-kit (current version: 0.10.0)

Typed with TypeScript Eslint code style: prettier tested with jest GitHub GitHub repo size GitHub code size in bytes

A starter kit for React Native written in Typescript with ❤️. A production-ready app with below functions:

Master: CI-Master codecov Quality Gate Status Maintainability Rating Security Rating

Develop: CI-Develop codecov

Fastlane: CI-Fastlane codecov

Fastlane-Staging: CI-Fastlane-Staging codecov

CI - CD integration with Github Actions

Another repo fastlane-credentials is used to store all credentials so the credentials are not shared to everyone. The structure of that repo:

- android (shared among multiple products/apps)
    - app
        - mobile.keystore (the keystore file of Android app)
    - fastlane
        - googlePlaySecretKey.json (the credential Fastlane use to publish to Playstore)
    - keystore.properties (the credential to unlock the keystore file)
- certs (the folder Fastlane match uses to store iOS certificates - shared among multiple products/apps)
- ios (shared among multiple products/apps)
    - .env.default  (the credential Fastlane uses to build and publish app to Testflight)
- profiles (the folder Fastlane match uses to store iOS profiles - shared among multiple products/apps)
- tqt-mobile-starter-kit (the current app configuration)
    - production (the production environment configuration)
        - android
            - app
                - google-services.json (the credential Firebase uses)
        - ios
            - GoogleService-Info.plist (the credential Firebase uses)
        - .env (the environment credentials mostly used by codepush)
        - sentry.properties (the credentials sentry uses)
    - staging (the production environment configuration, same structure as production)
        ...

We have 2 environments: production & staging. In each environment, we need to setup below apps:

  • 1 Android app
  • 1 iOS app
  • 1 Firebase app
  • 1 Facebook app
  • 1 Sentry app
  • 2 Appcenter (used for codepush) apps (see more)
  1. Development code stays at the develop branch
  2. Production code stays at the master branch
  3. To publish apps to the Playstore Alpha channel & Appstore Testflight, commit the code into the fastlane branch (use the fastlane-staging branch for the staging app)
  4. To publish apps to the Playstore Release channel, you should go to https://play.google.com/apps/publish and manually promote the app from the Playstore Alpha channel & update release notes (although Fastlane can automate it)
  5. To publish apps to the Playstore Release channel, you should go to https://appstoreconnect.apple.com and manually select the latest build & update release notes (although Fastlane can automate it)
  6. In case you want to update apps without publishing to store (only update javascript/typescript code), commit the code into the codepush branch (use the codepush-staging branch for the staging app) to publish it into the codepush Staging environment first. After testing is done, promote it to Production environment by committing code into the codepush-promote branch (use the codepush-promote-staging branch for the staging app)

Scripts

  • run Android:

yarn android

  • run iOS:

yarn ios

  • set environments (production/staging/etc), change related configurations (default is production):

yarn env production
yarn env staging

  • update app version, for example 1.4:

yarn update-ver <latest-version>

  • update app build number, for example 5 (should be ran by Github Actions):

yarn update-build <latest-build-number>

  • validate source code

yarn validate

  • get SHA1 of keystores

yarn android-signing

Update app icons & splash screens

  • install ImageMagick

brew install imagemagick

  • update src/assets/images/app-icon-1024.png

  • run


yarn update-icons

Sign in with Firebase

Follow rnfirebase

Publish app to stores with Fastlane

Android

  1. prepare credentials in the exact locations below:

android
app
mobile.keystore
fastlane
googlePlaySecretKey.json
keystore.properties

mobile.keystore: Learn how to generate keystore here

keystore.properties: store credentials to unlock mobile.keystore

googlePlaySecretKey.json: credentials used by Fastlane to publish app to store. Learn how to generate it here

  1. build app (optional)

yarn android-build

  1. build app to apk (optional)

yarn android-build-apk

  1. build app & publish to Alpha channel

yarn android-alpha

iOS

  1. prepare credentials in the exact locations below:

ios
.env.default

.env.default: fastlane environment variables stored here

MATCH_APP_IDENTIFIER= // all app ids

MATCH_GIT_URL= // match git url

MATCH_PASSWORD= // match password

APPLE_USERNAME= // apple username

APPLE_ITC_TEAM_ID= // apple itc team id

APPLE_TEAM_ID= // apple team id

FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD= // apple app password

FASTLANE_SESSION= // fastlane session

  1. run

cd ios && fastlane match

to initialize match & populate credentials to the git repo

  1. (update FASTLANE_SESSION)[https://docs.fastlane.tools/best-practices/continuous-integration/] by running

fastlane spaceauth -u [email protected]

  1. build app (optional)

yarn ios-build

  1. build app & publish to Testflight

yarn ios-testflight

Use code-push for OTA update

  • register a new account in https://appcenter.ms, create a new organization
  • create 1 app for Android & 1 app for iOS using appcenter cli under the newly created organization
  • run below commands to create Staging and Production deployments (read this guideline)

appcenter codepush deployment add Staging -a your-organization/your-app-android
appcenter codepush deployment add Production -a your-organization/your-app-android
appcenter codepush deployment add Staging -a your-organization/your-app-ios
appcenter codepush deployment add Production -a your-organization/your-app-ios

  • run appcenter codepush deployment list -a your-organization/your-app-android -k to get deployments keys (same for ios app)
  • run below commands to release Staging version and promote it to Production:

appcenter codepush release-react -a your-organization/your-app-android --description "deployment message"
appcenter codepush release-react -a your-organization/your-app-ios --description "deployment message"
appcenter codepush promote -a your-organization/your-app-android -s Staging -d Production
appcenter codepush promote -a your-organization/your-app-ios -s Staging -d Production

  • to get deployment history, run

appcenter codepush deployment history Staging -a your-organization/your-app-android

  • make another environment for the staging app (if you have a separate one)

Generate Privacy Policy & Terms & Conditions

https://app-privacy-policy-generator.firebaseapp.com/


npx react-native init mobile --template react-native-template-typescript


tqt-mobile-starter-kit's People

Contributors

thinhtran3588 avatar

Stargazers

Christopher Wiles avatar Amine Bl avatar John ngugi avatar TEDU - Technology Education avatar

Watchers

James Cloos avatar  avatar  avatar

tqt-mobile-starter-kit's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.