/
Fastfile
99 lines (85 loc) 路 2.97 KB
/
Fastfile
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
require_relative 'utils'
fastlane_require "spaceship"
lane :screenshots do
capture_android_screenshots
end
desc "Build debug and test APK for screenshots"
lane :build_for_screengrab do
gradle(
task: 'clean'
)
build_android_app(
task: 'assemble',
build_type: 'DebugPlaystore'
)
build_android_app(
task: 'assemble',
build_type: 'AndroidTestPlaystore'
)
end
desc "Capture Screen"
lane :capture_screen do
gradle(task: "clean assembleScreenshots assembleAndroidTest")
screengrab
end
desc 'Create a release and upload to internal channel of playstore'
lane :release do
PACKAGE_NAME = CredentialsManager::AppfileConfig.try_fetch_value(:package_name)
gradle_file = "./app/build.gradle.kts"
#fetch versionName from current release branch name
versionName = version_to_use_from_git_branch(gitBranch: git_branch).to_s
UI.important "Using versionName #{versionName}"
#fetch versionCode from playstore and bump it
versionCode = play_store_version_code_to_upload_to().to_s
UI.important "Releasing android app #{PACKAGE_NAME} v#{versionName} \##{versionCode}"
android_set_version_name(
version_name: versionName,
gradle_file: gradle_file
)
increment_version_code(
version_code: versionCode,
gradle_file_path: gradle_file
)
#build the bundle
gradle(
project_dir: './',
task: 'clean bundle',
build_type: 'offRelease',
platform: 'playstore'
)
#upload the bundle to internal track of play store
supply(
track: 'internal',
skip_upload_apk: true,
# version_codes_to_retain: ['12', '23'],
package_name: PACKAGE_NAME,
skip_upload_metadata: true,
skip_upload_changelogs: true,
skip_upload_images: true,
skip_upload_screenshots: true
)
sentry_create_release(
org_slug: 'openfoodfacts',
project_slug: 'openfoodfacts-android',
version: PACKAGE_NAME + '@' + versionName + '+' + versionCode,
finalize: false # Release will be finalized by the "finalize_sentry" lane, when the version is in production
)
sentry_set_commits(
org_slug: 'openfoodfacts',
project_slug: 'openfoodfacts-android',
version: PACKAGE_NAME + '@' + versionName + '+' + versionCode,
auto: true, # enable completely automated commit management
clear: false # clear all current commits from the release
)
end
desc 'Check the version currently in production and mark it as "finalized"'
lane :finalize_sentry do
PACKAGE_NAME = CredentialsManager::AppfileConfig.try_fetch_value(:package_name)
versionName = google_play_track_version_name(track: 'production')
versionCode = google_play_track_version_codes(track: 'production').max
sentry_finalize_release(
org_slug: 'openfoodfacts',
project_slug: 'openfoodfacts-android',
version: PACKAGE_NAME + '@' + versionName.to_s + '+' + versionCode.to_s,
)
end