Last active
June 22, 2019 13:06
-
-
Save moko256/c293a68319741c9aa347d5a920325c2e to your computer and use it in GitHub Desktop.
twitlatte-beta-publisher for Windows ("C:\Program Files\Git\git-bash.exe" upload.rb & PAUSE)
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
#! /bin/sh | |
exec ruby -S -x "$0" "$@" | |
#! ruby | |
require 'highline/import' | |
require 'json' | |
require 'fileutils' | |
PATH_APP = "twitlatte/app/release" | |
PATH_JSON = "#{PATH_APP}/output.json" | |
PATH_APK = "#{PATH_APP}/app-release.apk" | |
PATH_MAPPING = "twitlatte/app/build/outputs/mapping/release/mapping.txt" | |
PATH_TO_PARENT_DIR = "BACKUP_PATH" | |
PATH_METADATA = "twitlatte/fastlane/metadata/android" | |
def assertFileExist(path) | |
if !File.exist?(path) then | |
yield | |
end | |
end | |
answer = ask("アップロードを実行しますか(y/N)?") { |q| | |
q.default = "y" | |
q.validate = /[y|n]/ | |
} | |
if answer != "y" then | |
puts "cancel" | |
return | |
end | |
puts "Upload task starting" | |
assertFileExist(PATH_JSON) { | |
puts "\n[ERROR] output.json not found" | |
exit 1 | |
} | |
outputJson = JSON.load(File.read(PATH_JSON)) | |
versionName = outputJson[0]["apkData"]["versionName"] | |
versionCode = outputJson[0]["apkData"]["versionCode"] | |
puts "\n[INFO] Version #{versionName} (##{versionCode})" | |
parentDir = PATH_TO_PARENT_DIR | |
assertFileExist(PATH_TO_PARENT_DIR) { | |
puts "\n[ERROR] Couldn't create directory\n" | |
parentDir = File.absolute_path(ask("\n[PROMPT] Please enter the path to create")) | |
FileUtils.mkdir_p(parentDir) | |
} | |
toDir = parentDir + "/" + versionName | |
begin | |
Dir.mkdir(toDir) | |
FileUtils.cp([PATH_APK, PATH_MAPPING], toDir) | |
puts "\n[INFO] Copied APK and mapping.txt successfully" | |
rescue => e | |
puts e.message | |
end | |
Process.wait spawn("vim \"#{PATH_METADATA}/ja-JP/changelogs/#{versionCode}.txt\"") | |
Process.wait spawn("vim \"#{PATH_METADATA}/en-US/changelogs/#{versionCode}.txt\"") | |
puts "\n[INFO] Edited successfully" | |
Process.wait spawn("fastlane supply --metadata_path #{PATH_METADATA} --skip_upload_images true --skip_upload_screenshots true --apk #{PATH_APK} --mapping #{PATH_MAPPING} --json_key \"KEY_PATH\" --package_name com.github.moko256.twitlatte") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment