Skip to content

Commit 1a35365

Browse files
committed
cherry-pick master's release infrastructure
1 parent e65e013 commit 1a35365

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+433
-210
lines changed

.travis.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,8 @@ env:
88
- MATCH_KEYCHAIN_PASSWORD=alpine
99
# dirty hack for https://github.com/travis-ci/travis-ci/issues/5092
1010
- PATH=${PATH/\.\/node_modules\/\.bin/}
11-
# centralize some variables for pushing/committing
12-
- BRANCH=${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}
13-
- REPO=$(git config remote.origin.url)
14-
- SSH_REPO=${REPO/https:\/\/github.com\//[email protected]:}
15-
# this just gives us a nice label to use
16-
- ENCRYPTION_LABEL=199c454344e1
17-
# set some other variables for the pushing process
18-
- ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
19-
- ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
20-
- ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
21-
- ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
22-
- DEPLOY_KEY=scripts/travisci_deploy_key
2311
# variables that are used later on
24-
- TRAVIS_NODE_VERSION=7
12+
- TRAVIS_NODE_VERSION=8
2513
- PUSH_BRANCH=0
2614
- CAN_DEPLOY=0
2715
- USE_EMULATOR=no
@@ -34,7 +22,7 @@ matrix:
3422
dist: trusty
3523
sudo: false
3624
language: node_js
37-
node_js: '7'
25+
node_js: '8'
3826
env: [JS=yes, CAN_DEPLOY=yes]
3927

4028
- &android-base
@@ -49,11 +37,15 @@ matrix:
4937
- tools
5038
- platform-tools
5139
- build-tools-23.0.1
40+
- build-tools-23.0.2
41+
- build-tools-25.0.1
5242
- build-tools-23.0.3
5343
- build-tools-25.0.2
5444
- build-tools-25.0.3
45+
- build-tools-26.0.1
5546
- android-23
5647
- android-25
48+
- android-26
5749
- extra-android-m2repository
5850
- extra-google-m2repository
5951

@@ -72,7 +64,7 @@ matrix:
7264
- os: osx
7365
language: objective-c
7466
osx_image: xcode8.3
75-
node_js: '7'
67+
node_js: '8'
7668
env: [IOS=yes, CAN_DEPLOY=yes]
7769

7870

@@ -96,8 +88,15 @@ before_install:
9688
- rvm use ruby-2.3.1 --install --binary --create
9789
- gem install bundler
9890

99-
# only deploy from the once-daily cron-triggered jobs or from tagged commits
100-
- if [[ $CAN_DEPLOY = yes && ( $TRAVIS_EVENT_TYPE = cron || $TRAVIS_TAG != "" ) ]]; then run_deploy=1; fi
91+
# only deploy from:
92+
# - cron-triggered jobs
93+
# - tagged commits
94+
# - commits whose messages contain the string [ci run beta]
95+
- if [[ $CAN_DEPLOY = yes && (
96+
$TRAVIS_EVENT_TYPE == "cron" ||
97+
$TRAVIS_TAG != "" ||
98+
$TRAVIS_COMMIT_MESSAGE == *"[ci run beta]"*
99+
) ]]; then run_deploy=1; fi
101100

102101
# run our before_install sequence
103102
- bash scripts/travis/before_install.sh
@@ -106,7 +105,10 @@ install:
106105
- bash scripts/travis/install.sh
107106

108107
before_script:
109-
- bash scripts/travis/before_script.sh
108+
# Fire up the Android emulator
109+
- if [[ $ANDROID && $USE_EMULATOR = yes ]]; then
110+
bundle exec fastlane android ci-emulator;
111+
fi
110112

111113
script:
112114
- bash scripts/travis/script.sh
@@ -124,6 +126,7 @@ deploy:
124126
local_dir: docs/
125127
on:
126128
branch: master
129+
condition: $JS
127130

128131
before_cache:
129132
- rm -f "$HOME/.gradle/caches/modules-2/modules-2.lock"

fastlane/Appfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ app_identifier 'NFMTHAZVS9.com.drewvolz.stolaf'
44
# Your Apple email address
55
66

7-
# you can even provide different app identifiers, Apple IDs and team names per lane:
8-
# More information: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Appfile.md
7+
# This is a private key. It is not included in the repository.
8+
# Contact [email protected] or another admin if you need access.
9+
json_key_file 'fastlane/play-private-key.json'
10+
package_name 'com.allaboutolaf'

fastlane/Deliverfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
###################### More Options ######################
2+
# If you want to have even more control, check out the documentation
3+
# https://github.com/fastlane/fastlane/blob/master/deliver/Deliverfile.md
4+
5+
automatic_release false

fastlane/Fastfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
# https://github.com/fastlane/fastlane/tree/master/fastlane/docs
55

66
# Set a minimum version for fastlane
7-
fastlane_version '2.19.0'
7+
fastlane_version '2.50.1'
8+
9+
require 'fileutils'
810

911
import 'lib/before_all.rb'
1012
import 'lib/util.rb'

fastlane/README.md

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,11 @@ xcode-select --install
2929
</table>
3030

3131
# Available Actions
32-
### bump
32+
### keys
3333
```
34-
fastlane bump
34+
fastlane keys
3535
```
36-
Bump the version string to a new version
37-
### propagate-version
38-
```
39-
fastlane propagate-version
40-
```
41-
Copy the package.json version into the other version locations
42-
### release_notes
43-
```
44-
fastlane release_notes
45-
```
46-
Build the release notes: branch, commit hash, changelog
47-
### bundle_data
48-
```
49-
fastlane bundle_data
50-
```
51-
run `npm run bundle-data`
36+
Set up the private keys + environment variables for local development
5237

5338
----
5439

@@ -62,17 +47,27 @@ Makes a build
6247
```
6348
fastlane android beta
6449
```
65-
Submit a new Beta Build to HockeyApp
50+
Submit a new Beta Build to Google Play
51+
### android nightly
52+
```
53+
fastlane android nightly
54+
```
55+
Submit a new nightly Build to Google Play
6656
### android ci-run
6757
```
6858
fastlane android ci-run
6959
```
7060
Run the appropriate action on CI
71-
### android set_version
61+
### android ci-emulator
62+
```
63+
fastlane android ci-emulator
7264
```
73-
fastlane android set_version
65+
Set up an android emulator on TravisCI
66+
### android matchesque
7467
```
75-
Include the build number in the version string
68+
fastlane android matchesque
69+
```
70+
extract the android keys from the match repo
7671

7772
----
7873

@@ -91,12 +86,17 @@ Take screenshots
9186
```
9287
fastlane ios build
9388
```
94-
Provisions the profiles; bumps the build number; builds the app
89+
Builds the app
9590
### ios beta
9691
```
9792
fastlane ios beta
9893
```
9994
Submit a new Beta Build to Testflight
95+
### ios nightly
96+
```
97+
fastlane ios nightly
98+
```
99+
Submit a new nightly Beta Build to Testflight
100100
### ios refresh_dsyms
101101
```
102102
fastlane ios refresh_dsyms
@@ -107,11 +107,6 @@ Upload dYSM symbols to Bugsnag from Apple
107107
fastlane ios ci-run
108108
```
109109
Run iOS builds or tests, as appropriate
110-
### ios set_version
111-
```
112-
fastlane ios set_version
113-
```
114-
Include the build number in the version string
115110

116111
----
117112

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
module Fastlane
2+
module Actions
3+
class GetGradleVersionCodeAction < Action
4+
def self.run(params)
5+
gradle_path = params[:gradle_path]
6+
version_code = nil
7+
8+
File.foreach(gradle_path) do |line|
9+
if line.include? 'versionCode '
10+
components = line.strip.split(' ')
11+
version_code = components[1].tr('"', '')
12+
end
13+
end
14+
15+
if version_code.nil?
16+
UI.user_error! "Could not find the version code in #{gradle_path}"
17+
else
18+
UI.success "Version code: #{version_code}"
19+
end
20+
21+
version_code.to_i
22+
end
23+
24+
def self.description
25+
'Get the version code of your android project.'
26+
end
27+
28+
def self.authors
29+
['Hawken Rives']
30+
end
31+
32+
def self.available_options
33+
[
34+
FastlaneCore::ConfigItem.new(key: :gradle_path,
35+
description: 'The path to the build.gradle file',
36+
type: String),
37+
]
38+
end
39+
40+
def self.is_supported?(platform)
41+
[:android].include?(platform)
42+
end
43+
end
44+
end
45+
end

fastlane/actions/set_gradle_version_code.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ def self.available_options
4747
FastlaneCore::ConfigItem.new(key: :gradle_path,
4848
description: 'The path to the build.gradle file'),
4949
FastlaneCore::ConfigItem.new(key: :version_code,
50-
description: 'The version to change to'),
50+
description: 'The version to change to',
51+
type: Integer),
5152
]
5253
end
5354

fastlane/lib/before_all.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
before_all do
2+
case lane_context[:PLATFORM_NAME]
3+
when :ios
4+
setup_travis
5+
end
6+
27
# too lazy to change the name in travis, so we jut copy it here
38
ENV['FL_HOCKEY_API_TOKEN'] = ENV['HOCKEYAPP_TOKEN']
49
ENV['FL_HOCKEY_COMMIT_SHA'] = ENV['TRAVIS_COMMIT']

fastlane/lib/util.rb

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@ def authorize_ci_for_keys
99
end
1010
end
1111

12-
# Get the commit of the latest build on HockeyApp
13-
def hockeyapp_version_commit
14-
latest_hockeyapp_notes[:commit_hash]
15-
end
16-
1712
# Gets the version, either from Travis or from Hockey
18-
def current_build_number
13+
def current_build_number(**args)
1914
if ENV.key?('TRAVIS_BUILD_NUMBER')
2015
return ENV['TRAVIS_BUILD_NUMBER']
2116
end
2217

2318
begin
24-
(latest_testflight_build_number + 1).to_s
19+
case lane_context[:PLATFORM_NAME]
20+
when :android
21+
(google_play_track_version_codes(track: args[:track]) + 1).to_s
22+
when :ios
23+
(latest_testflight_build_number + 1).to_s
24+
else
25+
UI.input "Please enter a build number: "
26+
end
2527
rescue
2628
'1'
2729
end
@@ -40,6 +42,28 @@ def current_bundle_version
4042
end
4143
end
4244

45+
# Copy the package.json version into the other version locations
46+
def propagate_version(**args)
47+
version = get_package_key(key: :version)
48+
build = current_build_number(track: args[:track] || nil)
49+
50+
UI.message "Propagating version: #{version}"
51+
UI.message "into the Info.plist and build.gradle files"
52+
53+
# encode build number into js-land
54+
set_package_data(data: {version: "#{version}+#{build}"})
55+
56+
case lane_context[:PLATFORM_NAME]
57+
when :android
58+
set_gradle_version_name(version_name: version, gradle_path: lane_context[:GRADLE_FILE])
59+
set_gradle_version_code(version_code: build, gradle_path: lane_context[:GRADLE_FILE])
60+
when :ios
61+
# we're splitting here because iTC can't handle versions with dashes in them
62+
increment_version_number(version_number: version.split('-')[0], xcodeproj: ENV['GYM_PROJECT'])
63+
increment_build_number(build_number: build, xcodeproj: ENV['GYM_PROJECT'])
64+
end
65+
end
66+
4367
# Makes a changelog from the timespan passed
4468
def make_changelog
4569
to_ref = ENV['TRAVIS_COMMIT'] || 'HEAD'
@@ -55,14 +79,13 @@ def make_changelog
5579
# smart enough to call the appropriate platform's "beta" lane. So, let's make
5680
# a beta build if there have been new commits since the last beta.
5781
def auto_beta
58-
last_commit = hockeyapp_version_commit
59-
current_commit = last_git_commit[:commit_hash]
60-
61-
UI.message 'In faux-git terms:'
62-
UI.message "origin/hockeyapp: #{last_commit}"
63-
UI.message "HEAD: #{current_commit}"
64-
will_beta = last_commit != current_commit ? 'yes' : 'no'
65-
UI.message "Thus, will we beta? #{will_beta}"
66-
67-
beta if last_commit != current_commit
82+
if ENV['run_deploy'] == '1'
83+
if ENV['TRAVIS_EVENT_TYPE'] == 'cron'
84+
nightly
85+
else
86+
beta
87+
end
88+
else
89+
build
90+
end
6891
end
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
We can't wait to show you what we've been up to!
2+
3+
In this version:
4+
- You can reorder the home screen now!
5+
- Check out the Northfield events calendar!
6+
- Discover new student orgs to join!
7+
- Meals Remaining in SIS is back!
8+
- Hours redesign! More buildings! More hours!
9+
- Menus redesign! Better menus! Faster loading!
10+
- There's a new FAQs section in Settings! Check it out.
11+
- The Pause Events calendar is now included!
12+
- Numerous Bug Fixes

0 commit comments

Comments
 (0)