rework build scripts

This commit is contained in:
Kyle Spearrin 2020-06-08 13:19:44 -04:00
parent f4ad1ec8e7
commit e9efcf1b92
5 changed files with 30 additions and 14 deletions

View file

@ -4,6 +4,7 @@ $androidPath = $($rootPath + "\src\Android\Android.csproj");
$appPath = $($rootPath + "\src\App\App.csproj"); $appPath = $($rootPath + "\src\App\App.csproj");
$appKeystoreFdroidFilename = "app_fdroid-keystore.jks"; $appKeystoreFdroidFilename = "app_fdroid-keystore.jks";
$androidManifest = $($rootPath + "\src\Android\Properties\AndroidManifest.xml");
Write-Output "########################################" Write-Output "########################################"
Write-Output "##### Clean Android and App" Write-Output "##### Clean Android and App"
@ -80,11 +81,9 @@ Write-Output "########################################"
Invoke-Expression "& nuget restore" Invoke-Expression "& nuget restore"
Write-Output "########################################" # Build F-Droid Configuration
Write-Output "##### Build FDroid Configuration" $buildScriptPath = $($rootPath + ".\.github\scripts\android\build.ps1");
Write-Output "########################################" Invoke-Expression "& `"$buildScriptPath`" -configuration FDroid"
msbuild "$($androidPath)" "/p:Configuration=FDroid"
Write-Output "########################################" Write-Output "########################################"
Write-Output "##### Sign FDroid Configuration" Write-Output "##### Sign FDroid Configuration"

13
.github/scripts/android/build.ps1 vendored Normal file
View file

@ -0,0 +1,13 @@
param (
[Parameter(Mandatory=$true)]
[string] $configuration
)
$rootPath = $env:GITHUB_WORKSPACE;
$androidPath = $($rootPath + "\src\Android\Android.csproj");
Write-Output "########################################"
Write-Output "##### Build $configuration Configuration"
Write-Output "########################################"
msbuild "$($androidPath)" "/p:Configuration=$configuration"

View file

@ -14,14 +14,14 @@ $passphrase = $env:DECRYPT_FILE_PASSWORD
$secretOutputPath = $homePath + "\secrets" $secretOutputPath = $homePath + "\secrets"
if ([string]::IsNullOrEmpty($output)) { if ([string]::IsNullOrEmpty($output)) {
if($filename.EndsWith(".gpg")) { if ($filename.EndsWith(".gpg")) {
$output = $secretOutputPath + "\" + $filename.TrimEnd(".gpg") $output = $secretOutputPath + "\" + $filename.TrimEnd(".gpg")
} else { } else {
$output = $secretOutputPath + "\" + $filename + ".plaintext" $output = $secretOutputPath + "\" + $filename + ".plaintext"
} }
} }
if(!(Test-Path -Path $secretOutputPath)) if (!(Test-Path -Path $secretOutputPath))
{ {
New-Item -ItemType Directory -Path $secretOutputPath New-Item -ItemType Directory -Path $secretOutputPath
} }

View file

@ -43,36 +43,40 @@ jobs:
- name: Restore packages - name: Restore packages
run: nuget restore run: nuget restore
- name: Build for Play Store - name: Build
run: ./.github/scripts/android/build.ps1 -configuration Release
shell: pwsh
- name: Sign for Play Store
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
run: ./.github/scripts/android/build-play.ps1 run: ./.github/scripts/android/sign-play.ps1
shell: pwsh shell: pwsh
env: env:
PLAY_KEYSTORE_PASSWORD: ${{ secrets.PLAY_KEYSTORE_PASSWORD }} PLAY_KEYSTORE_PASSWORD: ${{ secrets.PLAY_KEYSTORE_PASSWORD }}
UPLOAD_KEYSTORE_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_PASSWORD }} UPLOAD_KEYSTORE_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_PASSWORD }}
- name: Upload Play Store .aab - name: Upload Play Store .aab artifact
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: com.x8bit.bitwarden.aab name: com.x8bit.bitwarden.aab
path: ./com.x8bit.bitwarden.aab path: ./com.x8bit.bitwarden.aab
- name: Upload Play Store .apk - name: Upload Play Store .apk artifact
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: com.x8bit.bitwarden.apk name: com.x8bit.bitwarden.apk
path: ./com.x8bit.bitwarden.apk path: ./com.x8bit.bitwarden.apk
- name: Build for F-Droid Store - name: Build and Sign for F-Droid Store
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
run: ./.github/scripts/android/build-fdroid.ps1 run: ./.github/scripts/android/build-sign-fdroid.ps1
shell: pwsh shell: pwsh
env: env:
FDROID_KEYSTORE_PASSWORD: ${{ secrets.FDROID_KEYSTORE_PASSWORD }} FDROID_KEYSTORE_PASSWORD: ${{ secrets.FDROID_KEYSTORE_PASSWORD }}
- name: Upload F-Droid .apk - name: Upload F-Droid .apk artifact
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with: