From 039ae7be5925181ec72df638b61c88178196883a Mon Sep 17 00:00:00 2001 From: Chd Date: Mon, 26 Mar 2018 12:56:25 +0200 Subject: [PATCH] add fastlane, beta deploy lanes, and jenkins release changes --- .gitignore | 7 ++- Gemfile | 3 + Gemfile.lock | 150 ++++++++++++++++++++++++++++++++++++++++++++ Jenkinsfile.nightly | 18 +++++- Jenkinsfile.release | 2 +- fastlane/Appfile | 13 ++++ fastlane/Fastfile | 33 ++++++++++ 7 files changed, 219 insertions(+), 7 deletions(-) create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 fastlane/Appfile create mode 100644 fastlane/Fastfile diff --git a/.gitignore b/.gitignore index 675633d7ff..acf6399474 100644 --- a/.gitignore +++ b/.gitignore @@ -100,6 +100,7 @@ ios/StatusIm.xcworkspace # For more information about the recommended setup visit: # https://docs.fastlane.tools/best-practices/source-control/ -*/fastlane/report.xml -*/fastlane/Preview.html -*/fastlane/screenshots \ No newline at end of file +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/README.md diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000000..7a118b49be --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "fastlane" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000000..e14e95ab08 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,150 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.0) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) + atomos (0.1.2) + babosa (1.0.2) + claide (1.0.2) + colored (1.2) + colored2 (3.1.2) + commander-fastlane (4.4.6) + highline (~> 1.7.2) + declarative (0.0.10) + declarative-option (0.1.0) + domain_name (0.5.20170404) + unf (>= 0.0.5, < 1.0.0) + dotenv (2.2.1) + excon (0.61.0) + faraday (0.14.0) + multipart-post (>= 1.2, < 3) + faraday-cookie_jar (0.0.6) + faraday (>= 0.7.4) + http-cookie (~> 1.0.0) + faraday_middleware (0.12.2) + faraday (>= 0.7.4, < 1.0) + fastimage (2.1.1) + fastlane (2.87.0) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.3, < 3.0.0) + babosa (>= 1.0.2, < 2.0.0) + bundler (>= 1.12.0, < 2.0.0) + colored + commander-fastlane (>= 4.4.6, < 5.0.0) + dotenv (>= 2.1.1, < 3.0.0) + excon (>= 0.45.0, < 1.0.0) + faraday (~> 0.9) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 0.9) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-api-client (>= 0.13.1, < 0.14.0) + highline (>= 1.7.2, < 2.0.0) + json (< 3.0.0) + mini_magick (~> 4.5.1) + multi_json + multi_xml (~> 0.5) + multipart-post (~> 2.0.0) + plist (>= 3.1.0, < 4.0.0) + public_suffix (~> 2.0.0) + rubyzip (>= 1.1.0, < 2.0.0) + security (= 0.1.3) + simctl (~> 1.6) + slack-notifier (>= 2.0.0, < 3.0.0) + terminal-notifier (>= 1.6.2, < 2.0.0) + terminal-table (>= 1.4.5, < 2.0.0) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.5.7, < 2.0.0) + xcpretty (>= 0.2.4, < 1.0.0) + xcpretty-travis-formatter (>= 0.0.3) + gh_inspector (1.1.3) + google-api-client (0.13.6) + addressable (~> 2.5, >= 2.5.1) + googleauth (~> 0.5) + httpclient (>= 2.8.1, < 3.0) + mime-types (~> 3.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.0) + googleauth (0.6.2) + faraday (~> 0.12) + jwt (>= 1.4, < 3.0) + logging (~> 2.0) + memoist (~> 0.12) + multi_json (~> 1.11) + os (~> 0.9) + signet (~> 0.7) + highline (1.7.10) + http-cookie (1.0.3) + domain_name (~> 0.5) + httpclient (2.8.3) + json (2.1.0) + jwt (2.1.0) + little-plugger (1.1.4) + logging (2.2.2) + little-plugger (~> 1.1) + multi_json (~> 1.10) + memoist (0.16.0) + mime-types (3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0521) + mini_magick (4.5.1) + multi_json (1.13.1) + multi_xml (0.6.0) + multipart-post (2.0.0) + nanaimo (0.2.4) + naturally (2.1.0) + os (0.9.6) + plist (3.4.0) + public_suffix (2.0.5) + representable (3.0.4) + declarative (< 0.1.0) + declarative-option (< 0.2.0) + uber (< 0.2.0) + retriable (3.1.1) + rouge (2.0.7) + rubyzip (1.2.1) + security (0.1.3) + signet (0.8.1) + addressable (~> 2.3) + faraday (~> 0.9) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + simctl (1.6.2) + CFPropertyList + naturally + slack-notifier (2.3.2) + terminal-notifier (1.8.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + tty-cursor (0.5.0) + tty-screen (0.6.4) + tty-spinner (0.8.0) + tty-cursor (>= 0.5.0) + uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.5) + unicode-display_width (1.3.0) + word_wrap (1.0.0) + xcodeproj (1.5.7) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.2) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.2.4) + xcpretty (0.2.8) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.0) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + ruby + +DEPENDENCIES + fastlane + +BUNDLED WITH + 1.16.1 diff --git a/Jenkinsfile.nightly b/Jenkinsfile.nightly index 8a607dbdc9..3a07d790bf 100644 --- a/Jenkinsfile.nightly +++ b/Jenkinsfile.nightly @@ -21,6 +21,7 @@ node ('macos1'){ def apkUrl = '' def ipaUrl = '' def testPassed = true + def latest_tag; load "$HOME/env.groovy" @@ -31,6 +32,10 @@ node ('macos1'){ checkout scm + latest_tag = sh(returnStdout: true, script: 'git describe --tags `git rev-list --tags --max-count=1`').trim() + + sh 'git fetch --tags' + sh 'git tag -D ' + latest_tag sh 'rm -rf node_modules' sh 'cp .env.jenkins .env' sh 'lein deps' @@ -53,24 +58,30 @@ node ('macos1'){ } stage('Build (iOS)') { + sh ('git tag ' + latest_tag) + def build_no = sh(returnStdout: true, script: 'git rev-list --count 0.9.15').trim() + sh ('plutil -replace CFBundleShortVersionString -string ' + latest_tag + ' ios/StatusIm/Info.plist') + sh ('plutil -replace CFBundleVersion -string ' + build_no + ' ios/StatusIm/Info.plist') sh 'export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/StatusIm.xcworkspace -scheme StatusIm -configuration release -archivePath status clean archive' - sh 'xcodebuild -exportArchive -exportPath status -archivePath status.xcarchive -exportOptionsPlist ~/archive.plist' + sh 'xcodebuild -exportArchive -exportPath status -archivePath status.xcarchive -exportOptionsPlist ~/archive-release.plist' } stage('Deploy (Android)') { def artifact_dir = pwd() + '/android/app/build/outputs/apk/release/' println (artifact_dir + 'app-release.apk') sh ('ls -la ' + artifact_dir) + sh ('rm ' + artifact_dir + "*") def artifact = (artifact_dir + 'app-release.apk') def server = Artifactory.server('artifacts') def shortCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim().take(6) def filename = 'im.status.ethereum-' + shortCommit + '.apk' def newArtifact = (artifact_dir + filename) - sh ('mv ' + artifact + ' ' + newArtifact) + sh ('cp ' + artifact + ' ' + newArtifact) def uploadSpec = '{ "files": [ { "pattern": "*apk/release/' + filename + '", "target": "nightlies-local" }]}' def buildInfo = server.upload(uploadSpec) apkUrl = 'http://artifacts.status.im:8081/artifactory/nightlies-local/' + filename + sh ('bundle exec fastlane android nightly') sh ('echo ARTIFACT Android: ' + apkUrl) } @@ -78,9 +89,10 @@ node ('macos1'){ withCredentials([string(credentialsId: 'diawi-token', variable: 'token')]) { def job = sh(returnStdout: true, script: 'curl https://upload.diawi.com/ -F token='+token+' -F file=@status/StatusIm.ipa -F find_by_udid=0 -F wall_of_apps=0 | jq -r ".job"').trim() sh 'sleep 10' - def hash = sh(returnStdout: true, script: "curl -vvv 'https://upload.diawi.com/status?token="+token+"&job="+job+"'|jq -r '.hash'").trim() + def hash = sh(returnStdout: true, script: "curl -vvv 'https://upload.diawi.com/status?token="+token+"&job="+job+"'|jq -r '.hash'").trim() ipaUrl = 'https://i.diawi.com/' + hash + sh ('bundle exec fastlane ios nightly') sh ('echo ARTIFACT iOS: ' + ipaUrl) } } diff --git a/Jenkinsfile.release b/Jenkinsfile.release index 134b3c792d..97791389b7 100644 --- a/Jenkinsfile.release +++ b/Jenkinsfile.release @@ -78,7 +78,7 @@ node ('macos1'){ withCredentials([string(credentialsId: 'diawi-token', variable: 'token')]) { def job = sh(returnStdout: true, script: 'curl https://upload.diawi.com/ -F token='+token+' -F file=@status/StatusIm.ipa -F find_by_udid=0 -F wall_of_apps=0 | jq -r ".job"').trim() sh 'sleep 10' - def hash = sh(returnStdout: true, script: "curl -vvv 'https://upload.diawi.com/status?token="+token+"&job="+job+"'|jq -r '.hash'").trim() + def hash = sh(returnStdout: true, script: "curl -vvv 'https://upload.diawi.com/status?token="+token+"&job="+job+"'|jq -r '.hash'").trim() ipaUrl = 'https://i.diawi.com/' + hash sh ('echo ARTIFACT iOS: ' + ipaUrl) diff --git a/fastlane/Appfile b/fastlane/Appfile new file mode 100644 index 0000000000..4341a2d9dd --- /dev/null +++ b/fastlane/Appfile @@ -0,0 +1,13 @@ +# iOS + +app_identifier("im.status.ethereum") # The bundle identifier of your app +apple_id(ENV["APPLE_ID"]) # Your Apple email address +itc_team_id("118430139") # iTunes Connect Team ID + +# Android + +# json_key_file("") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one +package_name("im.status.ethereum") # e.g. com.krausefx.app + +# For more information about the Appfile, see: +# https://docs.fastlane.tools/advanced/#appfile diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 0000000000..3f10f94b41 --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,33 @@ +# This file contains the fastlane.tools configuration +# You can find the documentation at https://docs.fastlane.tools +# +# For a list of all available actions, check out +# +# https://docs.fastlane.tools/actions +# + +# Uncomment the line if you want fastlane to automatically update itself +# update_fastlane + + +platform :ios do + desc "Deploy a new internal build to iTunes Connect" + lane :nightly do + upload_to_testflight( + ipa: "status/StatusIm.ipa" + ) + slack(message: "New nightly build uploaded to iTunes Connect") + end +end + + +platform :android do + desc "Deploy a new internal build to Google Play" + lane :nightly do + upload_to_play_store( + track: "internal", + apk: "android/app/build/outputs/apk/release/app-release.apk" + ) + slack(message: "New nightly build uploaded to Google Play") + end +end