-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
97 lines (94 loc) · 2.81 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
87
88
89
90
91
92
93
94
95
96
97
stages:
- name: test
if: type = pull_request AND branch = master
- name: tag
if: type = push AND branch = master AND tag IS blank
- name: deploy
if: type = push AND branch = master
jobs:
include:
# Run Flutter tests
- stage: test
name: flutter
language: dart
addons:
apt:
sources:
# To get correct version of libstdc++6
- ubuntu-toolchain-r-test
packages:
- libstdc++6
- fonts-droid
before_script:
# Install Flutter
- git clone https://github.com/flutter/flutter.git -b stable
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
- flutter doctor
script:
- cd app
- flutter test
# Tag commit with version
- stage: tag
name: tag
language: minimal
before_script:
# Calculate tag from previous
- export LAST_TRAVIS_TAG=$(git describe --abbrev=0 --tags)
- export TRAVIS_TAG=$((LAST_TRAVIS_TAG + 1))
# Decrypt secrets file
- openssl aes-256-cbc -K $encrypted_f6bf0014723e_key -iv $encrypted_f6bf0014723e_iv -in secrets.tar.enc -out secrets.tar -d
- tar xvf secrets.tar
# Set up SSH key for GitHub
- ssh-add github_deploy_key
script:
# Push tag to remote
- git tag $TRAVIS_TAG
- git push git@github.com:${TRAVIS_REPO_SLUG}.git $TRAVIS_BRANCH --tags
# Build and deploy APK for Android
- stage: deploy
name: android
language: android
jdk: openjdk8
android:
components:
- build-tools-28.0.3
- android-28
- android-27
addons:
# Deploy APK to S3 bucket
artifacts:
s3_region: eu-west-1
working_dir: build/app/outputs/apk/release
paths:
- app-release.apk
target_paths:
- /
apt:
sources:
# To get correct version of libstdc++6
- ubuntu-toolchain-r-test
packages:
- libstdc++6
- fonts-droid
before_script:
# Install Flutter
- git clone https://github.com/flutter/flutter.git -b stable
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
- flutter doctor
# Decrypt secrets file
- openssl aes-256-cbc -K $encrypted_f6bf0014723e_key -iv $encrypted_f6bf0014723e_iv -in secrets.tar.enc -out secrets.tar -d
- tar xvf secrets.tar
# Install Fastlane dependencies
- cd app && gem install bundler && cd android && bundle install && cd ../..
# Confirm that there is a tag set
- export TRAVIS_TAG=$(git tag --points-at HEAD)
- "[ -n \"$TRAVIS_TAG\" ] && echo $TRAVIS_TAG"
script:
# Package app for Android using tag
- cd app
- flutter packages get
- flutter build apk --release --build-number=$TRAVIS_TAG
# Deploy APK to Play Store using Fastlane
- cd android && bundle exec fastlane android alpha
# Go back to root app directory so S3 finds the APK
- cd ..