-
Notifications
You must be signed in to change notification settings - Fork 2.4k
172 lines (138 loc) · 6.76 KB
/
android.yml
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Android Build
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
tags:
- beta
jobs:
buildAAB:
name: Build Release AAB
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 10
- name: Cache multiple paths
uses: actions/cache@v2
with:
path: |
**/obj/**
!**.apk
!**.so
!**.aab
!**.dll
!jl
key: ${{ runner.os }}-buildAAB
- name: Build
shell: pwsh
run: |
$msbuildPath = Split-Path (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\Current\Bin\amd64\MSBuild.exe | Select-Object -First 1) -Parent
$env:PATH = $msbuildPath + ';' + $env:PATH
nuget locals all -clear
$current = Get-Location
$days = [int]((New-TimeSpan -Start 2020-01-01 -End (Get-Date)).totaldays * 100)
$manifest = [xml](Get-Content -Path ExtLibs\Xamarin\Xamarin.Android\Properties\AndroidManifest.xml -Raw)
$manifest.SelectNodes("manifest") | % { $_.versionCode = ""+$days }
$manifest.SelectNodes("manifest") | % { $_.versionName = ""+$days }
$manifest.Save($current.Path + "\ExtLibs\Xamarin\Xamarin.Android\Properties\AndroidManifest.xml")
choco install microsoft-openjdk --version=11.0.11.9
msbuild -v:m -restore -t:SignAndroidPackage -p:Configuration=Release "ExtLibs\Xamarin\Xamarin.Android\Xamarin.Android.csproj"
del ExtLibs\Xamarin\Xamarin.Android\bin\Release\com.michaeloborne.MissionPlanner-Signed.aab
mkdir whatsnew
git log --pretty=oneline --abbrev-commit -5 > whatsnew\whatsnew-en-US
git log --pretty=oneline --abbrev-commit -5 > whatsnew\whatsnew-en-GB
- name: Sign AAB
if: ${{ github.event_name == 'push' }}
id: sign
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: ExtLibs\Xamarin\Xamarin.Android\bin\Release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- uses: actions/upload-artifact@v4
with:
name: com.michaeloborne.MissionPlanner.aab.zip
path: ExtLibs\Xamarin\Xamarin.Android\bin\Release\*.aab
- name: Upload Android Release to Play Store
if: ${{ github.event_name == 'push' }}
uses: r0adkll/[email protected]
continue-on-error: true
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: com.michaeloborne.MissionPlanner
releaseFiles: ExtLibs\Xamarin\Xamarin.Android\bin\Release\com.michaeloborne.MissionPlanner.aab
track: internal
whatsNewDirectory: whatsnew
buildAPK:
name: Build Release APK
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 10
- name: Cache multiple paths
uses: actions/cache@v2
with:
path: |
**/obj/**
!**.apk
!**.so
!**.aab
!**.dll
!jl
key: ${{ runner.os }}-buildAPK
- name: Build
shell: pwsh
run: |
$msbuildPath = Split-Path (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\Current\Bin\amd64\MSBuild.exe | Select-Object -First 1) -Parent
$env:PATH = $msbuildPath + ';' + $env:PATH
nuget locals all -clear
$current = Get-Location
$days = [int]((New-TimeSpan -Start 2020-01-01 -End (Get-Date)).totaldays * 100)
$manifest = [xml](Get-Content -Path ExtLibs\Xamarin\Xamarin.Android\Properties\AndroidManifest.xml -Raw)
$manifest.SelectNodes("manifest") | % { $_.versionCode = ""+$days }
$manifest.SelectNodes("manifest") | % { $_.versionName = ""+$days }
$manifest.Save($current.Path + "\ExtLibs\Xamarin\Xamarin.Android\Properties\AndroidManifest.xml")
Set-Content -Path ExtLibs\Xamarin\Xamarin.Android\Xamarin.Android.csproj -Value (Get-Content -Path ExtLibs\Xamarin\Xamarin.Android\Xamarin.Android.csproj -Raw).Replace("<AndroidPackageFormat>aab</AndroidPackageFormat>","<AndroidPackageFormat>apk</AndroidPackageFormat>")
Set-Content -Path ExtLibs\Xamarin\Xamarin.Android\Xamarin.Android.csproj -Value (Get-Content -Path ExtLibs\Xamarin\Xamarin.Android\Xamarin.Android.csproj -Raw).Replace("<AotAssemblies>true</AotAssemblies>","<AotAssemblies>false</AotAssemblies>")
choco install microsoft-openjdk --version=11.0.11.9
msbuild -v:m -restore -t:SignAndroidPackage -p:Configuration=Release "ExtLibs\Xamarin\Xamarin.Android\Xamarin.Android.csproj"
del ExtLibs\Xamarin\Xamarin.Android\bin\Release\*-Signed.apk
$apks = Get-ChildItem -include *.apk -path ExtLibs\Xamarin\Xamarin.Android\bin\Release\ -Recurse
ForEach($i in $apks) {
echo $i.FullName
Move-Item -path $i.FullName temp.apk
C:\Android\android-sdk\build-tools\31.0.0\zipalign.exe -p -f -v 4 temp.apk $i.FullName
Remove-Item temp.apk
}
- name: Sign APK
if: ${{ github.event_name == 'push' }}
id: sign2
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: ExtLibs\Xamarin\Xamarin.Android\bin\Release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "31.0.0"
- uses: actions/upload-artifact@v4
with:
name: com.michaeloborne.MissionPlanner.apk.zip
path: ExtLibs\Xamarin\Xamarin.Android\bin\Release/${{ github.event_name == 'push' && '*-signed.apk' || '*.apk' }}
- uses: "marvinpinto/[email protected]"
if: ${{ github.event_name == 'push' }}
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Android Development Build"
files: '**/*-signed.apk'