-
Notifications
You must be signed in to change notification settings - Fork 13
/
.travis.yml
86 lines (83 loc) · 2.79 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
language: generic
dist: xenial
addons:
apt:
packages:
- lib32stdc++6
env:
global:
- FLUTTER_CHANNEL=dev
install:
- git clone https://github.com/flutter/flutter.git -b $FLUTTER_CHANNEL
- export PATH="$PATH:`pwd`/flutter/bin/cache/dart-sdk/bin"
- export PATH="$PATH:`pwd`/flutter/bin"
- flutter doctor -v
- flutter packages get
cache:
directories:
- $HOME/.pub-cache
static_analysis: &static_analysis
name: "Static analysis"
script: flutter analyze --no-current-package $TRAVIS_BUILD_DIR/lib
build: &build
name: "Build APK"
language: android
jdk:
- oraclejdk8
android:
components:
- tools
- tools # See (https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943)
- platform-tools
- build-tools-28.0.3
- android-27 # Breaks the build if not present (https://github.com/flutter/flutter/pull/26798#issuecomment-455758159)
- android-28
before_script:
- export BUILD_NAME=$TRAVIS_TAG
- export BUILD_NUMBER=$TRAVIS_BUILD_NUMBER
- echo "$PLAY_STORE_UPLOAD_KEY" | tr -d "'" | base64 --decode > $TRAVIS_BUILD_DIR/android/app/key.jks
script:
- if [[ $TRAVIS_TAG == "" ]]; then flutter build appbundle --verbose; else flutter build appbundle --build-name $BUILD_NAME --build-number $BUILD_NUMBER --verbose; fi
deploy:
- provider: releases
api_key: $GITHUB_TOKEN
file: build/app/outputs/bundle/release/app.aab
skip_cleanup: true
name: $TRAVIS_TAG
on:
tags: true
after_deploy:
- git branch $TRAVIS_TAG
- git push https://$GITHUB_TOKEN@github.com/$TRAVIS_REPO_SLUG.git $TRAVIS_TAG
google_play: &google_play
name: "Google Play"
install:
- bundle install --retry=3 --gemfile=android/Gemfile
# - echo "$PLAY_STORE_UPLOAD_KEY" | base64 --decode > $TRAVIS_BUILD_DIR/android/app/key.jks
before_script:
- chmod +x get_build_artifacts.sh
- export TRACK=$TRAVIS_BRANCH
- if [[ $TRAVIS_BRANCH == "prod" ]]; then export TRACK=production; fi
- mkdir -p "$TRAVIS_BUILD_DIR/build/app/outputs/bundle/release" && cd "$_"
- $TRAVIS_BUILD_DIR/get_build_artifacts.sh
- cd $TRAVIS_BUILD_DIR/android
script:
- if [[ $TRAVIS_PULL_REQUEST_BRANCH == beta || $TRAVIS_PULL_REQUEST_BRANCH = alpha || $TRAVIS_PULL_REQUEST_BRANCH = internal ]]; then
bundle exec fastlane promote;
else
bundle exec fastlane release;
fi
jobs:
include:
- <<: *static_analysis
- stage: build
<<: *build
- stage: deploy
<<: *google_play
stages:
- name: test
if: (NOT branch =~ /^\d*\.\d*\.\d*$/) OR (NOT branch IN (internal, alpha, beta, prod))
- name: build
if: (NOT branch =~ /^\d*\.\d*\.\d*$/) OR (NOT branch IN (internal, alpha, beta, prod))
- name: deploy
if: (type = push) AND (branch IN (internal, alpha, beta, prod))