env.LANG="en_US.UTF-8"
env.LANGUAGE="en_US.UTF-8"
env.LC_ALL="en_US.UTF-8"
env.FASTLANE_DISABLE_COLORS=1

timeout(90) {
    node ('macos'){

    stage('Git & Dependencies'){

      checkout([$class: 'GitSCM', branches: [[name: 'develop']],
      doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CleanBeforeCheckout']],
      submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/status-im/status-react.git']]])

      load "$HOME/env.groovy"
    }

    stage('Clean Testflight Users'){

      withCredentials([string(credentialsId: 'FASTLANE_PASSWORD', variable: 'FASTLANE_PASSWORD'),
      string(credentialsId: 'APPLE_ID', variable: 'APPLE_ID')]) {
        sh ('bundle install')
        sh ('bundle exec fastlane ios clean')}}
    }
}