-
-
Notifications
You must be signed in to change notification settings - Fork 153
Expand file tree
/
Copy pathFastfile
More file actions
169 lines (147 loc) · 5.69 KB
/
Fastfile
File metadata and controls
169 lines (147 loc) · 5.69 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# 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
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2023 Álvaro Brey <alvaro@alvarobrey.com>
# SPDX-License-Identifier: GPL-3.0-or-later
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
## config
# add following to your shell rc:
# export FASTLANE_NOTES_UPLOAD_STORE_FILE=""
# export FASTLANE_NOTES_UPLOAD_STORE_PASSWORD=""
# export FASTLANE_NOTES_UPLOAD_KEY_ALIAS=""
# export FASTLANE_NOTES_UPLOAD_KEY_PASSWORD=""
# export FASTLANE_NEXTCLOUD_GITHUB_API_TOKEN=""
skip_docs
default_platform(:android)
BUNDLE_PATH = "app/build/outputs/bundle/playRelease/app-play-release.aab"
ENV['SUPPLY_UPLOAD_MAX_RETRIES']='10'
import("./common.Fastfile")
platform :android do
desc "Build app bundle"
desc "Run tests and build app"
lane :releasePhase1 do
test()
buildBundle()
versionInfo = getVersionInfo()
buildSignedAPK(versionCode: versionInfo["versionCode"])
end
desc "Release previously built app to Google Play and create tag"
lane :releasePhase2 do
versionInfo = getVersionInfo()
versionComponents = parseVersionCode(versionInfo)
checkReleasable(versionComponents)
storeTrack = getPlayStoreTrack(versionComponents)
tagName = getTagName(versionComponents)
preReleaseChecks(versionInfo: versionInfo, tagName: tagName, type: versionComponents["type"], track: storeTrack)
checkArtifactsExist()
tag(name: tagName)
createGithubRelease(name: versionInfo["versionName"], tag: tagName, versionCode: versionInfo["versionCode"], track: storeTrack)
uploadToPlayStore(track: storeTrack)
end
desc "Run tests"
lane :test do
gradle(task: "clean testPlayReleaseUnitTest testFdroidReleaseUnitTest")
end
desc "Build app bundle"
lane :buildBundle do
gradle(
task: 'bundle',
flavor: 'play',
build_type: 'Release',
print_command: false,
properties: {
"android.injected.signing.store.file" => ENV["FASTLANE_NOTES_UPLOAD_STORE_FILE"],
"android.injected.signing.store.password" => ENV["FASTLANE_NOTES_UPLOAD_STORE_PASSWORD"],
"android.injected.signing.key.alias" => ENV["FASTLANE_NOTES_UPLOAD_KEY_ALIAS"],
"android.injected.signing.key.password" => ENV["FASTLANE_NOTES_UPLOAD_KEY_PASSWORD"],
}
)
end
desc "Build APK"
lane :buildSignedAPK do |options|
gradle(
task: 'assemble',
flavor: 'play',
build_type: 'Release',
print_command: false,
properties: {
"android.injected.signing.store.file" => ENV["FASTLANE_NOTES_UPLOAD_STORE_FILE"],
"android.injected.signing.store.password" => ENV["FASTLANE_NOTES_UPLOAD_STORE_PASSWORD"],
"android.injected.signing.key.alias" => ENV["FASTLANE_NOTES_UPLOAD_KEY_ALIAS"],
"android.injected.signing.key.password" => ENV["FASTLANE_NOTES_UPLOAD_KEY_PASSWORD"],
}
)
sh("mkdir -p ../release/")
sh("mv ../app/build/outputs/apk/play/release/app-play-release.apk ../release/nextcloud-notes-#{options[:versionCode]}.apk")
end
desc "Show versions and prompt for confirmation"
private_lane :preReleaseChecks do |options|
versionInfo = options[:versionInfo]
tagName = options[:tagName]
currentBranch = git_branch()
text = "Version code: #{versionInfo["versionCode"]}\n" +
"Version name: #{versionInfo["versionName"]}\n" +
"Current branch: #{currentBranch}\n" +
"Version type: #{options[:type]}\n" +
"Tag: #{tagName}\n" +
"Track: #{options[:track]}"
promptYesNo(text: text)
end
desc "Check if release artifacts exist"
private_lane :checkArtifactsExist do
if !File.exist?("../#{BUNDLE_PATH}")
UI.user_error!("Bundle not found at #{BUNDLE_PATH}")
end
end
desc "Create release tag"
private_lane :tag do |options|
tagName = options[:name]
add_git_tag(
tag: tagName,
sign: true
)
push_git_tags(tag: tagName)
end
desc "Upload release artifacts to Google Play"
private_lane :uploadToPlayStore do |options|
upload_to_play_store(
skip_upload_images: true,
skip_upload_apk: true,
track: options[:track],
aab: BUNDLE_PATH
)
end
private_lane :createGithubRelease do |options|
set_github_release(
repository_name: "nextcloud/notes-android",
api_token: ENV["FASTLANE_NEXTCLOUD_GITHUB_API_TOKEN"],
name: options[:name],
tag_name: options[:tag],
is_prerelease: options[:track] == 'beta' ? true : false,
description: (File.read("metadata/android/en-US/changelogs/" + options[:versionCode] + ".txt") rescue "No changelog provided"),
upload_assets: [ "release/nextcloud-notes-" + options[:versionCode].to_s + ".apk" ]
)
end
desc "Upload Alpha version to play store"
lane :uploadAlphaToPlayStore do |options|
upload_to_play_store(
skip_upload_images: true,
skip_upload_aab: true,
skip_upload_changelogs: true,
skip_upload_metadata: true,
skip_upload_screenshots: true,
track: 'alpha',
apk: "/home/androiddaily/apks-notes/android-notes-" + options[:version] + ".apk",
)
end
end