Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
Merge pull request #529 from textileio/asutula/new-builds
Browse files Browse the repository at this point in the history
Tag Releases etc.
  • Loading branch information
asutula committed Oct 1, 2018
2 parents 4c6d4c4 + 6bed94d commit 89bb659
Show file tree
Hide file tree
Showing 16 changed files with 299 additions and 33 deletions.
138 changes: 129 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ jobs:
- store_artifacts:
path: android/test-results

android-beta:
android-adhoc:
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
Expand Down Expand Up @@ -180,9 +180,51 @@ jobs:

- run: yarn install

- run: git config --global user.name $CIRCLE_USERNAME
- run: git config --global user.email "ops@textile.io" # TODO: Use a variable here
- run: git branch --set-upstream-to=origin/$CIRCLE_BRANCH $CIRCLE_BRANCH
- restore_cache:
key: bundle-v1-{{ checksum "android/Gemfile.lock" }}-{{ arch }}

- run:
command: bundle install
working_directory: android

- save_cache:
key: bundle-v1-{{ checksum "android/Gemfile.lock" }}-{{ arch }}
paths:
- vendor/bundle

- run:
command: echo $ANDROID_KEYSTORE_BASE64 | base64 --decode >> $ANDROID_KEYSTORE
working_directory: android

- run:
command: echo $TEXTILE_ENV_CONTENTS_BASE64 | base64 --decode > .env.production

- run:
command: bundle exec fastlane adhoc
working_directory: android

- store_artifacts:
path: ./android/sourcemap.js

android-release:
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
working_directory: ~/textile-mobile
docker:
- image: circleci/android:api-26-node8-alpha
resource_class: large
steps:
- checkout:
path: ~/textile-mobile

- restore_cache:
key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}

- restore_cache:
key: node-v1-{{ checksum "package.json" }}-{{ arch }}

- run: yarn install

- restore_cache:
key: bundle-v1-{{ checksum "android/Gemfile.lock" }}-{{ arch }}
Expand All @@ -204,7 +246,7 @@ jobs:
command: echo $TEXTILE_ENV_CONTENTS_BASE64 | base64 --decode > .env.production

- run:
command: bundle exec fastlane beta
command: bundle exec fastlane release
working_directory: android

- store_artifacts:
Expand Down Expand Up @@ -290,7 +332,7 @@ jobs:
- store_artifacts:
path: ios/test-results

ios-beta:
ios-adhoc:
macos:
xcode: "9.4.0"
environment:
Expand Down Expand Up @@ -359,7 +401,73 @@ jobs:
command: echo $TEXTILE_ENV_CONTENTS_BASE64 | base64 --decode > .env.production

- run:
command: bundle exec fastlane beta
command: bundle exec fastlane adhoc
working_directory: ios

- store_artifacts:
path: ./ios/TextilePhotos.app.dSYM.zip

- store_artifacts:
path: ./ios/TextilePhotos.ipa

- store_artifacts:
path: ./ios/sourcemap.js

ios-release:
macos:
xcode: "9.4.0"
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
working_directory: ~/textile-mobile

# use a --login shell so our "set Ruby version" command gets picked up for later steps
shell: /bin/bash --login -o pipefail

steps:
- run:
name: set Ruby version
command: echo "ruby-2.4" > ~/.ruby-version

- checkout

- restore_cache:
key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}

- restore_cache:
key: node-v1-{{ checksum "package.json" }}-{{ arch }}

# not using a workspace here as Node and Yarn versions
# differ between our macOS executor image and the Docker containers above
- run: yarn install --ignore-engines

- save_cache:
key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}
paths:
- ~/.cache/yarn

- save_cache:
key: node-v1-{{ checksum "package.json" }}-{{ arch }}
paths:
- node_modules

- restore_cache:
key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}-{{ arch }}

- run:
command: bundle install
working_directory: ios

- save_cache:
key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}-{{ arch }}
paths:
- vendor/bundle

- run:
command: echo $TEXTILE_ENV_CONTENTS_BASE64 | base64 --decode > .env.production

- run:
command: bundle exec fastlane release
working_directory: ios

- store_artifacts:
Expand Down Expand Up @@ -401,13 +509,25 @@ workflows:
branches:
ignore:
- master
- ios-beta:
- ios-adhoc:
filters:
branches:
only:
- master
- android-beta:
- android-adhoc:
filters:
branches:
only:
- master
- ios-release:
filters:
tags:
only: /^ios_[0-9.]+_[0-9]+/
branches:
ignore: /.*/
- android-release:
filters:
tags:
only: /^android_[0-9.]+_[0-9]+/
branches:
ignore: /.*/
3 changes: 2 additions & 1 deletion App/SB/views/UserProfile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { NavigationActions } from 'react-navigation'
import ImageSc from 'react-native-scalable-image'
import Toast, { DURATION } from 'react-native-easy-toast'
import HeaderButtons, { Item } from 'react-navigation-header-buttons'
import VersionNumber from 'react-native-version-number'

import { TextileHeaderButtons, Item as TextileItem } from '../../../Components/HeaderButtons'

Expand Down Expand Up @@ -104,9 +105,9 @@ class UserProfile extends React.PureComponent {
<View style={styles.contentContainer}>
<View style={styles.logoContainer}>
<ImageSc width={83} source={require('./statics/textile-gray-logo.png')} />
<Text style={styles.versionDescription}>{VersionNumber.appVersion} ({VersionNumber.buildVersion})</Text>
</View>
{this.connectivity()}

<TouchableOpacity style={styles.listItemFirst} onPress={this._notifications.bind(this)}>
<Text style={styles.listText}>Notifications</Text>
</TouchableOpacity>
Expand Down
7 changes: 7 additions & 0 deletions App/SB/views/UserProfile/statics/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export default StyleSheet.create({
paddingVertical: 25
},
serversText: {
fontFamily: 'BentonSans',
color: '#4A4A4A'
},
activeIcon: {
Expand Down Expand Up @@ -103,6 +104,12 @@ export default StyleSheet.create({
alignItems: 'center',
marginTop: 30
},
versionDescription: {
fontFamily: 'BentonSans',
fontSize: 12,
marginTop: 8,
color: 'rgb(200,200,200)'
},
subScreen: {
backgroundColor: '#FAFCFE',
paddingTop: 75,
Expand Down
14 changes: 8 additions & 6 deletions android/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
GIT
remote: git://github.com/cball/fastlane-plugin-android_versioning.git
revision: 4fe9f3dd3109d58dc5870c417d7b17b016585a8d
ref: support-blank-id-suffix
specs:
fastlane-plugin-android_versioning (0.3.1)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -62,9 +69,6 @@ GEM
xcodeproj (>= 1.6.0, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
fastlane-plugin-get_version_code (0.2.0)
fastlane-plugin-get_version_name (0.2.2)
fastlane-plugin-increment_version_code (0.4.3)
gh_inspector (1.1.3)
google-api-client (0.23.9)
addressable (~> 2.5, >= 2.5.1)
Expand Down Expand Up @@ -147,9 +151,7 @@ PLATFORMS
DEPENDENCIES
dotenv
fastlane
fastlane-plugin-get_version_code
fastlane-plugin-get_version_name
fastlane-plugin-increment_version_code
fastlane-plugin-android_versioning!

BUNDLED WITH
1.16.2
5 changes: 3 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ android {
}
vectorDrawables.useSupportLibrary = true

versionName "1.6.10"
versionCode 214
versionName "0"
versionCode 0
}

splits {
Expand Down Expand Up @@ -172,6 +172,7 @@ android {
}

dependencies {
compile project(':react-native-version-number')
compile project(':react-native-push-notification')
compile project(':react-native-fabric')
compile project(':react-native-image-picker')
Expand Down
2 changes: 2 additions & 0 deletions android/app/src/main/java/com/textile/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.textile.textilenode.TextileNodePackage;
import com.transistorsoft.rnbackgroundfetch.RNBackgroundFetchPackage;
import com.vydia.RNUploader.UploaderReactPackage;
import com.apsl.versionnumber.RNVersionNumberPackage;

import java.util.Arrays;
import java.util.List;
Expand All @@ -36,6 +37,7 @@ protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new FabricPackage(),
new MainReactPackage(),
new RNVersionNumberPackage(),
new ReactNativePushNotificationPackage(),
new UploaderReactPackage(),
new ImagePickerPackage(),
Expand Down
35 changes: 30 additions & 5 deletions android/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ default_platform(:android)

platform :android do

def set_version_code(gradle_build: 'app/build.gradle', version: 0)
sh %Q{cd ../ && echo "$(awk '{sub(/versionCode [0-9]+$/,"versionCode "#{version})}1' #{gradle_build})" > #{gradle_build}.tmp && mv #{gradle_build}.tmp #{gradle_build} && cd -}
end

desc "Runs all the tests"
lane :test do
gradle(
Expand All @@ -29,10 +25,24 @@ platform :android do
)
end

desc "Push internal test build to Fabric"
lane :adhoc do
increment_version_code(version_code: ENV['CIRCLE_BUILD_NUM'])
gradle(
task: "clean assembleRelease",
flags: "--init-script init.gradle"
)
crashlytics(
api_token: ENV['FABRIC_API_TOKEN'],
build_secret: ENV['FABRIC_BUILD_SECRET'],
groups: 'textile-internal'
)
end

desc "Submit a new Beta Build to Crashlytics Beta"
lane :beta do
versionCodes = google_play_track_version_codes(track: "internal")
set_version_code(version: versionCodes[0] + 1)
increment_version_code(version_code: versionCodes[0] + 1)
gradle(
task: "clean assembleRelease",
flags: "--init-script init.gradle"
Expand All @@ -53,6 +63,21 @@ platform :android do
push_to_git_remote
end

desc "Submit a new release to Google Play Store"
lane :release do
tag = ENV['CIRCLE_TAG'] # looks like android_1.2.3_456
parts = tag.split("_")
increment_version_name(app_project_dir: "./app", version_name: parts[1])
increment_version_code(app_project_dir: "./app", version_code: parts[2])
gradle(
task: "clean assembleRelease",
flags: "--init-script init.gradle"
)
supply(
track: "beta"
)
end

desc "Deploy a new version to the Google Play"
lane :deploy do
gradle(task: "clean assembleRelease")
Expand Down
4 changes: 1 addition & 3 deletions android/fastlane/Pluginfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
#
# Ensure this file is checked in to source control!

gem 'fastlane-plugin-increment_version_code'
gem 'fastlane-plugin-get_version_code'
gem 'fastlane-plugin-get_version_name'
gem 'fastlane-plugin-android_versioning', github: "cball/fastlane-plugin-android_versioning", ref: "support-blank-id-suffix"
10 changes: 10 additions & 0 deletions android/fastlane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,21 @@ or alternatively using `brew cask install fastlane`
fastlane android test
```
Runs all the tests
### android adhoc
```
fastlane android adhoc
```
Push internal test build to Fabric
### android beta
```
fastlane android beta
```
Submit a new Beta Build to Crashlytics Beta
### android release
```
fastlane android release
```
Submit a new release to Google Play Store
### android deploy
```
fastlane android deploy
Expand Down
2 changes: 2 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
rootProject.name = 'Textile'
include ':react-native-version-number'
project(':react-native-version-number').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-version-number/android')
include ':react-native-push-notification'
project(':react-native-push-notification').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-push-notification/android')
include ':react-native-fabric'
Expand Down
Loading

0 comments on commit 89bb659

Please sign in to comment.