From fa6d2a3080561bc94e7f41469ba1793b6f0bbc81 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 8 Jun 2020 16:04:04 -0400 Subject: [PATCH] break steps out a bit more --- ...build-sign-fdroid.ps1 => clean-fdroid.ps1} | 33 ------------------- .github/scripts/android/sign-fdroid.ps1 | 23 +++++++++++++ .github/scripts/android/sign-play.ps1 | 10 ------ .github/workflows/build.yml | 17 ++++++++-- 4 files changed, 37 insertions(+), 46 deletions(-) rename .github/scripts/android/{build-sign-fdroid.ps1 => clean-fdroid.ps1} (66%) create mode 100644 .github/scripts/android/sign-fdroid.ps1 diff --git a/.github/scripts/android/build-sign-fdroid.ps1 b/.github/scripts/android/clean-fdroid.ps1 similarity index 66% rename from .github/scripts/android/build-sign-fdroid.ps1 rename to .github/scripts/android/clean-fdroid.ps1 index b6c55c970..33fd3cde0 100644 --- a/.github/scripts/android/build-sign-fdroid.ps1 +++ b/.github/scripts/android/clean-fdroid.ps1 @@ -3,7 +3,6 @@ $androidPath = $($rootPath + "\src\Android\Android.csproj"); $appPath = $($rootPath + "\src\App\App.csproj"); -$appKeystoreFdroidFilename = "app_fdroid-keystore.jks"; $androidManifest = $($rootPath + "\src\Android\Properties\AndroidManifest.xml"); Write-Output "########################################" @@ -74,35 +73,3 @@ $appCenterNode=$xml.SelectSingleNode("/Project/ItemGroup/PackageReference[@Inclu $appCenterNode.ParentNode.RemoveChild($appCenterNode); $xml.Save($appPath); - -Write-Output "########################################" -Write-Output "##### Restore NuGet" -Write-Output "########################################" - -Invoke-Expression "& nuget restore" - -# Build F-Droid Configuration -$buildScriptPath = $($rootPath + ".\.github\scripts\android\build.ps1"); -Invoke-Expression "& `"$buildScriptPath`" -configuration FDroid" - -Write-Output "########################################" -Write-Output "##### Sign FDroid Configuration" -Write-Output "########################################" - -msbuild "$($androidPath)" "/t:SignAndroidPackage" "/p:Configuration=FDroid" "/p:AndroidKeyStore=true" ` - "/p:AndroidSigningKeyAlias=bitwarden" "/p:AndroidSigningKeyPass=$($env:FDROID_KEYSTORE_PASSWORD)" ` - "/p:AndroidSigningKeyStore=$($appKeystoreFdroidFilename)" ` - "/p:AndroidSigningStorePass=$($env:FDROID_KEYSTORE_PASSWORD)" "/v:quiet" - -Write-Output "########################################" -Write-Output "##### Copy FDroid apk to project root" -Write-Output "########################################" - -$signedApkPath = $($rootPath + "\src\Android\bin\FDroid\com.x8bit.bitwarden-Signed.apk"); -$signedApkDestPath = $($rootPath + "\com.x8bit.bitwarden-fdroid.apk"); - -Copy-Item $signedApkPath $signedApkDestPath - -Write-Output "########################################" -Write-Output "##### Done" -Write-Output "########################################" diff --git a/.github/scripts/android/sign-fdroid.ps1 b/.github/scripts/android/sign-fdroid.ps1 new file mode 100644 index 000000000..983e4583a --- /dev/null +++ b/.github/scripts/android/sign-fdroid.ps1 @@ -0,0 +1,23 @@ +$rootPath = $env:GITHUB_WORKSPACE; + +$androidPath = $($rootPath + "\src\Android\Android.csproj"); + +$appKeystoreFdroidFilename = "app_fdroid-keystore.jks"; + +Write-Output "########################################" +Write-Output "##### Sign FDroid Configuration" +Write-Output "########################################" + +msbuild "$($androidPath)" "/t:SignAndroidPackage" "/p:Configuration=FDroid" "/p:AndroidKeyStore=true" ` + "/p:AndroidSigningKeyAlias=bitwarden" "/p:AndroidSigningKeyPass=$($env:FDROID_KEYSTORE_PASSWORD)" ` + "/p:AndroidSigningKeyStore=$($appKeystoreFdroidFilename)" ` + "/p:AndroidSigningStorePass=$($env:FDROID_KEYSTORE_PASSWORD)" "/v:quiet" + +Write-Output "########################################" +Write-Output "##### Copy FDroid apk to project root" +Write-Output "########################################" + +$signedApkPath = $($rootPath + "\src\Android\bin\FDroid\com.x8bit.bitwarden-Signed.apk"); +$signedApkDestPath = $($rootPath + "\com.x8bit.bitwarden-fdroid.apk"); + +Copy-Item $signedApkPath $signedApkDestPath diff --git a/.github/scripts/android/sign-play.ps1 b/.github/scripts/android/sign-play.ps1 index d96ee4a35..ea684e11c 100644 --- a/.github/scripts/android/sign-play.ps1 +++ b/.github/scripts/android/sign-play.ps1 @@ -5,12 +5,6 @@ $androidPath = $($rootPath + "\src\Android\Android.csproj"); $appKeystorePlayFilename = "app_play-keystore.jks"; $appKeystoreUploadFilename = "app_upload-keystore.jks"; -Write-Output "########################################" -Write-Output "##### Build Release Configuration" -Write-Output "########################################" - -msbuild "$($androidPath)" "/p:Configuration=Release" - Write-Output "########################################" Write-Output "##### Sign Google Play Bundle Release Configuration" Write-Output "########################################" @@ -46,7 +40,3 @@ $signedApkPath = $($rootPath + "\src\Android\bin\Release\com.x8bit.bitwarden-Sig $signedApkDestPath = $($rootPath + "\com.x8bit.bitwarden.apk"); Copy-Item $signedApkPath $signedApkDestPath - -Write-Output "########################################" -Write-Output "##### Done" -Write-Output "########################################" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1635a7104..75e07f77c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,7 +43,7 @@ jobs: - name: Restore packages run: nuget restore - - name: Build + - name: Build for Play Store run: ./.github/scripts/android/build.ps1 -configuration Release shell: pwsh @@ -69,9 +69,20 @@ jobs: name: com.x8bit.bitwarden.apk path: ./com.x8bit.bitwarden.apk - - name: Build and Sign for F-Droid Store + - name: Clean for F-Droid + run: ./.github/scripts/android/clean-fdroid.ps1 + shell: pwsh + + - name: Restore packages + run: nuget restore + + - name: Build for F-Droid + run: ./.github/scripts/android/build.ps1 -configuration FDroid + shell: pwsh + + - name: Sign for F-Droid if: github.ref == 'refs/heads/master' - run: ./.github/scripts/android/build-sign-fdroid.ps1 + run: ./.github/scripts/android/sign-fdroid.ps1 shell: pwsh env: FDROID_KEYSTORE_PASSWORD: ${{ secrets.FDROID_KEYSTORE_PASSWORD }}