mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 18:08:26 +03:00
play store publisher
This commit is contained in:
parent
57af4e0a03
commit
144197daaf
5 changed files with 202 additions and 0 deletions
29
appveyor.yml
Normal file
29
appveyor.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#init:
|
||||||
|
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||||
|
#on_finish:
|
||||||
|
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||||
|
#install:
|
||||||
|
# - choco install cloc --no-progress
|
||||||
|
# - "cloc --vcs git --exclude-dir Resources,store,test,UWP,Properties --include-lang C#,JavaScript,TypeScript,PowerShell"
|
||||||
|
# - appveyor DownloadFile https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
|
||||||
|
# - appveyor DownloadFile https://aka.ms/vs/15/release/vs_community.exe
|
||||||
|
# - vs_community.exe update --wait --quiet --norestart --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
|
||||||
|
# - ps: .\src\Android\update-android.ps1
|
||||||
|
before_build:
|
||||||
|
- nuget restore
|
||||||
|
- IF DEFINED keystore_dec_secret nuget install secure-file -ExcludeVersion
|
||||||
|
- IF DEFINED google_services_dec_secret secure-file\tools\secure-file -decrypt src\Android\google-services.json.enc -secret %google_services_dec_secret%
|
||||||
|
after_build:
|
||||||
|
- ps: IF($env:keystore_dec_secret) { .\src\Android\ci-build-apks.ps1 }
|
||||||
|
on_success:
|
||||||
|
- IF DEFINED play_dec_secret secure-file\tools\secure-file -decrypt store\google\Publisher\play_creds.json.enc -secret %play_dec_secret%
|
||||||
|
- IF DEFINED play_dec_secret dotnet store\google\Publisher\bin\Release\netcoreapp2.0\Publisher.dll %APPVEYOR_BUILD_FOLDER%\store\google\Publisher\play_creds.json %APPVEYOR_BUILD_FOLDER%\com.x8bit.bitwarden-%APPVEYOR_BUILD_NUMBER%.apk alpha
|
||||||
|
artifacts:
|
||||||
|
- path: com.x8bit.bitwarden-%APPVEYOR_BUILD_NUMBER%.apk
|
||||||
|
- path: com.x8bit.bitwarden-fdroid-%APPVEYOR_BUILD_NUMBER%.apk
|
||||||
|
branches:
|
||||||
|
except:
|
||||||
|
- l10n_master
|
||||||
|
skip_tags: true
|
||||||
|
configuration: Release
|
||||||
|
image: Visual Studio 2017
|
|
@ -17,8 +17,24 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{D10CA4A9-F86
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8904C536-C67D-420F-9971-51B26574C3AA}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8904C536-C67D-420F-9971-51B26574C3AA}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "store", "store", "{92470CBD-9047-4C3C-8EA3-D972D6622D84}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "google", "google", "{2E399654-26A2-46F6-B9CA-1B496A3F370A}"
|
||||||
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iOS.Core", "src\iOS.Core\iOS.Core.csproj", "{E71F3053-056C-4381-9638-048ED73BDFF6}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iOS.Core", "src\iOS.Core\iOS.Core.csproj", "{E71F3053-056C-4381-9638-048ED73BDFF6}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{76690DFB-B7F4-4781-83E4-113FDC450AFE}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
.gitignore = .gitignore
|
||||||
|
appveyor.yml = appveyor.yml
|
||||||
|
CONTRIBUTING.md = CONTRIBUTING.md
|
||||||
|
crowdin.yml = crowdin.yml
|
||||||
|
README.md = README.md
|
||||||
|
SECURITY.md = SECURITY.md
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Publisher", "store\google\Publisher\Publisher.csproj", "{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
|
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
|
||||||
|
@ -215,6 +231,30 @@ Global
|
||||||
{E71F3053-056C-4381-9638-048ED73BDFF6}.Release|iPhone.Build.0 = Release|Any CPU
|
{E71F3053-056C-4381-9638-048ED73BDFF6}.Release|iPhone.Build.0 = Release|Any CPU
|
||||||
{E71F3053-056C-4381-9638-048ED73BDFF6}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
{E71F3053-056C-4381-9638-048ED73BDFF6}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||||
{E71F3053-056C-4381-9638-048ED73BDFF6}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
{E71F3053-056C-4381-9638-048ED73BDFF6}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.AppStore|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.AppStore|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Release|iPhone.Build.0 = Release|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -225,7 +265,9 @@ Global
|
||||||
{EE44C6A1-2A85-45FE-8D9B-BF1D5F88809C} = {D10CA4A9-F866-40E1-B658-F69051236C71}
|
{EE44C6A1-2A85-45FE-8D9B-BF1D5F88809C} = {D10CA4A9-F866-40E1-B658-F69051236C71}
|
||||||
{4B8A8C41-9820-4341-974C-41E65B7F4366} = {D10CA4A9-F866-40E1-B658-F69051236C71}
|
{4B8A8C41-9820-4341-974C-41E65B7F4366} = {D10CA4A9-F866-40E1-B658-F69051236C71}
|
||||||
{9C8DA5A8-904D-466F-B9B0-1A4AB5A9AFC3} = {8904C536-C67D-420F-9971-51B26574C3AA}
|
{9C8DA5A8-904D-466F-B9B0-1A4AB5A9AFC3} = {8904C536-C67D-420F-9971-51B26574C3AA}
|
||||||
|
{2E399654-26A2-46F6-B9CA-1B496A3F370A} = {92470CBD-9047-4C3C-8EA3-D972D6622D84}
|
||||||
{E71F3053-056C-4381-9638-048ED73BDFF6} = {D10CA4A9-F866-40E1-B658-F69051236C71}
|
{E71F3053-056C-4381-9638-048ED73BDFF6} = {D10CA4A9-F866-40E1-B658-F69051236C71}
|
||||||
|
{256F9E44-0AF5-4D97-A2F9-DA26080C0A5D} = {2E399654-26A2-46F6-B9CA-1B496A3F370A}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {7D436EA3-8B7E-45D2-8D14-0730BD2E0410}
|
SolutionGuid = {7D436EA3-8B7E-45D2-8D14-0730BD2E0410}
|
||||||
|
|
118
store/google/Publisher/Program.cs
Normal file
118
store/google/Publisher/Program.cs
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
using Google.Apis.AndroidPublisher.v2;
|
||||||
|
using Google.Apis.AndroidPublisher.v2.Data;
|
||||||
|
using Google.Apis.Auth.OAuth2;
|
||||||
|
using Google.Apis.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Bit.Publisher
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
private const string Package = "com.x8bit.bitwarden";
|
||||||
|
|
||||||
|
private static string _apkFilePath;
|
||||||
|
private static string _credsFilePath;
|
||||||
|
private static string _track;
|
||||||
|
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
if(args.Length < 3)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Not enough arguments.");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_credsFilePath = args[0];
|
||||||
|
_apkFilePath = args[1];
|
||||||
|
|
||||||
|
var track = args[2].Substring(0, 1).ToLower();
|
||||||
|
if(track == "a")
|
||||||
|
{
|
||||||
|
_track = "alpha";
|
||||||
|
}
|
||||||
|
else if(track == "b")
|
||||||
|
{
|
||||||
|
_track = "beta";
|
||||||
|
}
|
||||||
|
else if(track == "p")
|
||||||
|
{
|
||||||
|
_track = "production";
|
||||||
|
}
|
||||||
|
else if(track == "r")
|
||||||
|
{
|
||||||
|
_track = "rollout";
|
||||||
|
}
|
||||||
|
else if(track == "i")
|
||||||
|
{
|
||||||
|
_track = "internal";
|
||||||
|
}
|
||||||
|
|
||||||
|
new Program().Run().Wait();
|
||||||
|
}
|
||||||
|
catch(AggregateException ex)
|
||||||
|
{
|
||||||
|
foreach(var e in ex.InnerExceptions)
|
||||||
|
{
|
||||||
|
Console.WriteLine("ERROR: " + e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task Run()
|
||||||
|
{
|
||||||
|
GoogleCredential creds;
|
||||||
|
using(var stream = new FileStream(_credsFilePath, FileMode.Open))
|
||||||
|
{
|
||||||
|
creds = GoogleCredential.FromStream(stream).CreateScoped(
|
||||||
|
AndroidPublisherService.Scope.Androidpublisher);
|
||||||
|
}
|
||||||
|
|
||||||
|
var service = new AndroidPublisherService(new BaseClientService.Initializer
|
||||||
|
{
|
||||||
|
HttpClientInitializer = creds
|
||||||
|
});
|
||||||
|
|
||||||
|
var editRequest = service.Edits.Insert(null, Package);
|
||||||
|
var edit = await editRequest.ExecuteAsync();
|
||||||
|
|
||||||
|
Console.WriteLine("Created edit with id {0}.", edit.Id);
|
||||||
|
|
||||||
|
Apk apk = null;
|
||||||
|
using(var stream = new FileStream(_apkFilePath, FileMode.Open))
|
||||||
|
{
|
||||||
|
var uploadMedia = service.Edits.Apks.Upload(Package, edit.Id, stream,
|
||||||
|
"application/vnd.android.package-archive");
|
||||||
|
|
||||||
|
var progress = await uploadMedia.UploadAsync();
|
||||||
|
if(progress.Status == Google.Apis.Upload.UploadStatus.Completed)
|
||||||
|
{
|
||||||
|
apk = uploadMedia.ResponseBody;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception("Upload failed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("Version code {0} has been uploaded.", apk.VersionCode);
|
||||||
|
|
||||||
|
var trackRequest = service.Edits.Tracks.Update(new Track
|
||||||
|
{
|
||||||
|
VersionCodes = new List<int?> { apk.VersionCode }
|
||||||
|
}, Package, edit.Id, _track);
|
||||||
|
|
||||||
|
var updatedTrack = await trackRequest.ExecuteAsync();
|
||||||
|
Console.WriteLine("Track {0} has been updated.", updatedTrack.TrackValue);
|
||||||
|
|
||||||
|
var commitRequest = service.Edits.Commit(Package, edit.Id);
|
||||||
|
var commitEdit = await commitRequest.ExecuteAsync();
|
||||||
|
Console.WriteLine("App edit with id {0} has been comitted.", commitEdit.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
13
store/google/Publisher/Publisher.csproj
Normal file
13
store/google/Publisher/Publisher.csproj
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
|
<RootNamespace>Bit.Publisher</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Google.Apis.AndroidPublisher.v2" Version="1.40.0.1601" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
BIN
store/google/Publisher/play_creds.json.enc
Normal file
BIN
store/google/Publisher/play_creds.json.enc
Normal file
Binary file not shown.
Loading…
Reference in a new issue