forked from kolplattformen/skolplattformen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(added fastlane fastfile and appfile)
Co-authored-by: Sebastian Palmqvist <[email protected]>
- Loading branch information
1 parent
3a436dd
commit 940bb7b
Showing
2 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Filename: android/fastlane/Appfile | ||
|
||
json_key_file("key.json") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one | ||
package_name("com.projectname.app") # EDIT: The bundle identifier of your app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# Filename: android/fastlane/Fastfile | ||
|
||
default_platform(:android) | ||
|
||
platform :android do | ||
desc "Runs all the tests" | ||
lane :test do | ||
gradle(task: "test") | ||
end | ||
|
||
desc "Submit a new Beta Build to Play Store" | ||
lane :beta do |options| | ||
|
||
if ENV['ENVFILE'].nil? | ||
puts "ENVFILE is not set. Please set ENVFILE to the path of your .env file. If unsure, look at .github/**/*android*yml" | ||
exit(1) | ||
end | ||
|
||
store_password = ENV['SIGNING_STORE_PASSWORD'] || prompt(text: "Signing Store Password: ", secure_text: true) | ||
key_password = ENV['ALIAS_KEY_PASSWORD'] || prompt(text: "Alias Key Password: ", secure_text: true) | ||
|
||
# Fetch version_code from play store and bump it. Annoyingly, we always need | ||
# to increment it, even if our version name changes. | ||
internalVersionCode = google_play_track_version_codes(track: 'internal').max | ||
ENV['VERSION_CODE'] = (internalVersionCode + 1).to_s | ||
|
||
versionNameOverride = nil | ||
# versionNameOverride = "1.9.0" | ||
if versionNameOverride.nil? | ||
releaseNameSemVerArr = google_play_track_release_names(track: 'internal').max.split('.') | ||
releaseNameSemVerArr[2] = (releaseNameSemVerArr.last.to_i + 1).to_s | ||
ENV['VERSION_NAME'] = releaseNameSemVerArr.join('.') | ||
ENV['SUPPLY_VERSION_NAME'] = ENV['VERSION_NAME'] | ||
versionFile = File.join(Dir.pwd, '..', 'version', 'version.properties').to_s | ||
commandargs = "-n \"VERSION=#{ENV['VERSION_NAME']}\" > #{versionFile}".to_s | ||
puts "echo #{commandargs}" | ||
system("echo", commandargs) | ||
else | ||
ENV['VERSION_NAME'] = versionNameOverride | ||
end | ||
puts "Compiling #{ENV['VERSION_NAME']} (#{ENV['VERSION_CODE']}) " | ||
|
||
|
||
# Dir.pwd when running through Fastlane is app/android/fastlane | ||
releaseFilePath = File.join(Dir.pwd, '..', 'app', "my-upload-key.keystore") | ||
mappingFilePath = File.join( | ||
Dir.pwd, | ||
"..", | ||
"app", | ||
"build", | ||
"outputs", | ||
"mapping", | ||
"release", | ||
"mapping.txt" | ||
) | ||
|
||
|
||
gradle(task: 'clean') | ||
gradle( | ||
task: 'bundle', | ||
build_type: 'Release', | ||
print_command: false, | ||
properties: { | ||
"android.injected.signing.store.file" => releaseFilePath, | ||
"android.injected.signing.store.password" => store_password, | ||
"android.injected.signing.key.alias" => "my-key-alias", | ||
"android.injected.signing.key.password" => key_password, | ||
"android.injected.version.code" => ENV['VERSION_CODE'], | ||
"android.injected.version.name" => ENV['VERSION_NAME'], | ||
} | ||
) | ||
|
||
symbolsFilePath = File.join( | ||
Dir.pwd, | ||
"..", | ||
"native_debug_symbols.zip" | ||
) | ||
symbolsFolderPath = File.join( | ||
Dir.pwd, | ||
"..", | ||
"app", | ||
"build", | ||
"intermediates", | ||
"merged_native_libs", | ||
"release", | ||
"out", | ||
"lib" | ||
) | ||
system("cd #{symbolsFolderPath} && zip -r #{symbolsFilePath} .") | ||
upload_to_play_store( | ||
track: 'internal', | ||
release_status: 'draft', | ||
version_code: ENV['VERSION_CODE'], | ||
version_name: ENV['VERSION_NAME'], | ||
version_codes_to_retain: [], | ||
mapping_paths: [mappingFilePath, symbolsFilePath] | ||
) | ||
|
||
system('git config user.email "[email protected]"') | ||
system('git config user.name "Github Actions Android Pipeline"') | ||
|
||
add_git_tag( | ||
grouping: "builds", | ||
includes_lane: true, | ||
prefix: "v#{ENV['VERSION_NAME']}-", | ||
build_number: ENV['VERSION_CODE'], | ||
) | ||
push_to_git_remote( | ||
tags: true | ||
) | ||
end | ||
end |