1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-05 23:53:33 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Alexey Zilber
d8ac0adf83 Merge remote-tracking branch 'origin/master' into CLOUDOPS-202_Google-Account-Migration 2022-11-21 15:27:24 +08:00
Alexey Zilber
44dfe0022c Abstracting out Package name in uploader and workflow. 2022-11-03 13:47:52 +08:00
3 changed files with 43 additions and 28 deletions

View File

@@ -11,6 +11,9 @@ on:
workflow_dispatch:
inputs: {}
env:
BASE_PKG_NAME: com.x8bit.bitwarden
jobs:
cloc:
name: CLOC
@@ -174,11 +177,11 @@ jobs:
UPLOAD_KEYSTORE_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_PASSWORD }}
run: |
$androidPath = $($env:GITHUB_WORKSPACE + "/src/Android/Android.csproj");
$packageName = "com.x8bit.bitwarden";
$packageName = "";
if ("${{ matrix.variant }}" -ne "prod")
{
$packageName = "com.x8bit.bitwarden.${{ matrix.variant }}";
$packageName = "${{ env.BASE_PKG_NAME }}.${{ matrix.variant }}";
}
Write-Output "########################################"
Write-Output "##### Sign Google Play Bundle Release Configuration"
@@ -219,24 +222,24 @@ jobs:
if: ${{ matrix.variant == 'prod' }}
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with:
name: com.x8bit.bitwarden.aab
path: ./com.x8bit.bitwarden.aab
name: ${{ env.BASE_PKG_NAME }}.aab
path: ./${{ env.BASE_PKG_NAME }}.aab
if-no-files-found: error
- name: Upload Prod .apk artifact
if: ${{ matrix.variant == 'prod' }}
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with:
name: com.x8bit.bitwarden.apk
path: ./com.x8bit.bitwarden.apk
name: ${{ env.BASE_PKG_NAME }}.apk
path: ./${{ env.BASE_PKG_NAME }}.apk
if-no-files-found: error
- name: Upload Other .apk artifact
if: ${{ matrix.variant != 'prod' }}
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with:
name: com.x8bit.bitwarden.${{ matrix.variant }}.apk
path: ./com.x8bit.bitwarden.${{ matrix.variant }}.apk
name: ${{ env.BASE_PKG_NAME }}.${{ matrix.variant }}.apk
path: ./${{ env.BASE_PKG_NAME }}.${{ matrix.variant }}.apk
if-no-files-found: error
- name: Deploy to Play Store
@@ -248,10 +251,10 @@ jobs:
run: |
PUBLISHER_PATH="$GITHUB_WORKSPACE/store/google/Publisher/bin/Release/netcoreapp3.1/Publisher.dll"
CREDS_PATH="$HOME/secrets/play_creds.json"
AAB_PATH="$GITHUB_WORKSPACE/com.x8bit.bitwarden.aab"
AAB_PATH="$GITHUB_WORKSPACE/${{env:BASE_PKG_NAME}}.aab"
TRACK="internal"
dotnet $PUBLISHER_PATH $CREDS_PATH $AAB_PATH $TRACK
dotnet $PUBLISHER_PATH $CREDS_PATH $AAB_PATH $TRACK ${{env:BASE_PKG_NAME}}
shell: bash
@@ -424,8 +427,8 @@ jobs:
Write-Output "##### Copy FDroid apk to project root"
Write-Output "########################################"
$signedApkPath = $($env:GITHUB_WORKSPACE + "/src/Android/bin/FDroid/com.x8bit.bitwarden-Signed.apk");
$signedApkDestPath = $($env:GITHUB_WORKSPACE + "/com.x8bit.bitwarden-fdroid.apk");
$signedApkPath = $($env:GITHUB_WORKSPACE + "/src/Android/bin/FDroid/$env:BASE_PKG_NAME-Signed.apk");
$signedApkDestPath = $($env:GITHUB_WORKSPACE + "/$env:BASE_PKG_NAME-fdroid.apk");
Copy-Item $signedApkPath $signedApkDestPath
shell: pwsh
@@ -433,8 +436,8 @@ jobs:
- name: Upload F-Droid .apk artifact
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with:
name: com.x8bit.bitwarden-fdroid.apk
path: ./com.x8bit.bitwarden-fdroid.apk
name: ${{ env.BASE_PKG_NAME }}.apk
path: ./${{ env.BASE_PKG_NAME }}.apk
if-no-files-found: error

View File

@@ -20,6 +20,9 @@ on:
default: true
type: boolean
env:
BASE_PKG_NAME: com.x8bit.bitwarden
jobs:
release:
name: Create Release
@@ -89,9 +92,9 @@ jobs:
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
uses: ncipollo/release-action@40bb172bd05f266cf9ba4ff965cb61e9ee5f6d01 # v1.9.0
with:
artifacts: "./com.x8bit.bitwarden.aab/com.x8bit.bitwarden.aab,
./com.x8bit.bitwarden.apk/com.x8bit.bitwarden.apk,
./com.x8bit.bitwarden-fdroid.apk/com.x8bit.bitwarden-fdroid.apk,
artifacts: "./${{ BASE_PKG_NAME }}.aab/${{ BASE_PKG_NAME }}.aab,
./${{ BASE_PKG_NAME }}.apk/${{ BASE_PKG_NAME }}.apk,
./${{ BASE_PKG_NAME }}-fdroid.apk/${{ BASE_PKG_NAME }}-fdroid.apk,
./Bitwarden iOS.zip"
commit: ${{ github.sha }}
tag: v${{ steps.version.outputs.version }}
@@ -133,7 +136,7 @@ jobs:
workflow: build.yml
workflow_conclusion: success
branch: ${{ needs.release.outputs.branch-name }}
name: com.x8bit.bitwarden-fdroid.apk
name: ${{ BASE_PKG_NAME }}-fdroid.apk
- name: Dry Run - Download F-Droid .apk artifact
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
@@ -142,7 +145,7 @@ jobs:
workflow: build.yml
workflow_conclusion: success
branch: master
name: com.x8bit.bitwarden-fdroid.apk
name: ${{ BASE_PKG_NAME }}-fdroid.apk
- name: Set up Node
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # v2.5.1
@@ -198,7 +201,7 @@ jobs:
echo "keystorepass=\"$FDROID_STORE_KEYSTORE_PASSWORD\"" >>config.py
echo "local_copy_dir=\"$TEMP_DIR\"" >>config.py
mkdir -p repo
mv $GITHUB_WORKSPACE/com.x8bit.bitwarden-fdroid.apk ./repo/
mv $GITHUB_WORKSPACE/${{ BASE_PKG_NAME }}-fdroid.apk ./repo/
fdroid update
fdroid server update
cd ..

View File

@@ -9,25 +9,34 @@ using Google.Apis.Services;
namespace Bit.Publisher
{
// static class to hold global variables, etc.
static class Globals
{
// global string
// private const string Package = "com.x8bit.bitwarden";
public static string Package;
}
public class Program
{
private const string Package = "com.x8bit.bitwarden";
private static string _aabFilePath;
private static string _credsFilePath;
private static string _track;
static void Main(string[] args)
{
if (args.Length < 3)
if (args.Length < 4)
{
throw new ArgumentException("Not enough arguments.");
throw new ArgumentException("Not enough arguments (needs 4), got: " + args.Length);
}
try
{
_credsFilePath = args[0];
_aabFilePath = args[1];
Globals.Package = args[3];
var track = args[2].Substring(0, 1).ToLower();
if (track == "a")
@@ -79,7 +88,7 @@ namespace Bit.Publisher
});
service.HttpClient.Timeout = TimeSpan.FromMinutes(3);
var editRequest = service.Edits.Insert(null, Package);
var editRequest = service.Edits.Insert(null, Globals.Package);
var edit = await editRequest.ExecuteAsync();
Console.WriteLine("Created edit with id {0}.", edit.Id);
@@ -87,7 +96,7 @@ namespace Bit.Publisher
Bundle aab = null;
using (var stream = new FileStream(_aabFilePath, FileMode.Open))
{
var uploadMedia = service.Edits.Bundles.Upload(Package, edit.Id, stream,
var uploadMedia = service.Edits.Bundles.Upload(Globals.Package, edit.Id, stream,
"application/octet-stream");
var progress = await uploadMedia.UploadAsync();
@@ -114,12 +123,12 @@ namespace Bit.Publisher
{
new TrackRelease { VersionCodes = new List<long?> { aab.VersionCode }, Status = "completed" }
}
}, Package, edit.Id, _track);
}, Globals.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 commitRequest = service.Edits.Commit(Globals.Package, edit.Id);
var commitEdit = await commitRequest.ExecuteAsync();
Console.WriteLine("App edit with id {0} has been comitted.", commitEdit.Id);
}