Skip to content

Fix int underlow

Fix int underlow #2327

Workflow file for this run

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'