From 60c9519095313948a05c27ca04aece93a9f2d7fe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Sep 2019 16:21:37 +0900 Subject: [PATCH] Add proper signing and github release support --- fastlane/Fastfile | 48 +++++++++++++++++++++++++++++++++++++++++----- fastlane/README.md | 5 +++++ 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 906d284bc9..7adf42a1eb 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -4,14 +4,12 @@ platform :android do desc 'Deploy to play store' lane :beta do |options| - # update csproj version update_version( - solution_path: 'osu.Android.sln', version: options[:version], build: options[:build], ) - build() + build(options) supply( apk: './osu.Android/bin/Release/sh.ppy.osulazer-Signed.apk', @@ -21,8 +19,35 @@ desc 'Deploy to play store' ) end + desc 'Deploy to github release' + lane :build_github do |options| + + update_version( + version: options[:version], + build: options[:build], + ) + + build(options) + + client = HTTPClient.new + changelog = client.get_content 'https://gist.githubusercontent.com/peppy/aaa2ec1a323554b619671cac6dbbb776/raw' + changelog.gsub!('$BUILD_ID', options[:build]) + + set_github_release( + repository_name: "ppy/osu", + api_token: ENV["GITHUB_TOKEN"], + name: options[:build], + tag_name: options[:build], + is_draft: true, + description: changelog, + commitish: "master", + upload_assets: ["osu.Android/bin/Release/sh.ppy.osulazer.apk"] + ) + + end + desc 'Compile the project' - lane :build do + lane :build do |options| nuget_restore( project_path: 'osu.Android.sln' ) @@ -31,11 +56,24 @@ desc 'Deploy to play store' build_configuration: 'Release', solution_path: 'osu.Android.sln', platform: "android", + output_path: "osu.Android/bin/Release/", + keystore_path: options[:keystore_path], + keystore_alias: options[:keystore_alias], + keystore_password: ENV["KEYSTORE_PASSWORD"] ) end lane :update_version do |options| - app_version(options) + + split = options[:build].split('.') + split[1] = split[1].to_s.rjust(4, '0') + android_build = split.join('') + + app_version( + solution_path: 'osu.Android.sln', + version: options[:version], + build: android_build, + ) end end diff --git a/fastlane/README.md b/fastlane/README.md index 6145620870..a400ed9516 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -21,6 +21,11 @@ or alternatively using `brew cask install fastlane` fastlane android beta ``` Deploy to play store +### android build_github +``` +fastlane android build_github +``` +Deploy to github release ### android build ``` fastlane android build