2021-09-02 22:04:41 +02:00
|
|
|
---
|
2020-06-05 19:51:57 +02:00
|
|
|
name: Build
|
|
|
|
|
2020-06-08 18:14:10 +02:00
|
|
|
on:
|
|
|
|
push:
|
2020-06-08 18:17:53 +02:00
|
|
|
branches-ignore:
|
2023-01-10 19:48:22 +01:00
|
|
|
- "l10n_master"
|
|
|
|
- "gh-pages"
|
2022-02-23 16:34:26 +01:00
|
|
|
paths-ignore:
|
2023-01-10 19:48:22 +01:00
|
|
|
- ".github/workflows/**"
|
2022-02-28 19:30:27 +01:00
|
|
|
workflow_dispatch:
|
2020-06-05 19:51:57 +02:00
|
|
|
|
2024-02-08 20:05:26 +01:00
|
|
|
env:
|
|
|
|
main_app_folder_path: src/App
|
|
|
|
main_app_project_path: src/App/App.csproj
|
|
|
|
target-net-version: net8.0
|
2024-10-10 11:51:28 +02:00
|
|
|
dotnet-version: '8.0.402'
|
|
|
|
maui-workload-version: '8.0.402'
|
2024-02-08 20:05:26 +01:00
|
|
|
|
2020-06-05 19:51:57 +02:00
|
|
|
jobs:
|
2020-06-09 19:18:22 +02:00
|
|
|
cloc:
|
2021-09-02 22:04:41 +02:00
|
|
|
name: CLOC
|
2023-11-27 23:18:28 +01:00
|
|
|
runs-on: ubuntu-22.04
|
2020-06-09 19:18:22 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2024-07-16 21:06:47 +02:00
|
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
2020-06-09 19:18:22 +02:00
|
|
|
|
2021-09-24 19:50:54 +02:00
|
|
|
- name: Set up CLOC
|
2020-06-09 19:18:22 +02:00
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get -y install cloc
|
|
|
|
|
|
|
|
- name: Print lines of code
|
|
|
|
run: cloc --vcs git --exclude-dir Resources,store,test,Properties --include-lang C#,XAML
|
|
|
|
|
2024-02-28 13:48:16 +01:00
|
|
|
|
2021-10-22 22:16:57 +02:00
|
|
|
setup:
|
|
|
|
name: Setup
|
2023-11-27 23:18:28 +01:00
|
|
|
runs-on: ubuntu-22.04
|
2021-10-22 22:16:57 +02:00
|
|
|
outputs:
|
|
|
|
rc_branch_exists: ${{ steps.branch-check.outputs.rc_branch_exists }}
|
2021-11-08 15:48:40 +01:00
|
|
|
hotfix_branch_exists: ${{ steps.branch-check.outputs.hotfix_branch_exists }}
|
2021-10-22 22:16:57 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2024-07-16 21:06:47 +02:00
|
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
2023-03-09 19:45:51 +01:00
|
|
|
with:
|
|
|
|
submodules: 'true'
|
2021-10-22 22:16:57 +02:00
|
|
|
|
|
|
|
- name: Check if special branches exist
|
|
|
|
id: branch-check
|
|
|
|
run: |
|
|
|
|
if [[ $(git ls-remote --heads origin rc) ]]; then
|
2022-12-05 16:04:34 +01:00
|
|
|
echo "rc_branch_exists=1" >> $GITHUB_OUTPUT
|
2021-10-22 22:16:57 +02:00
|
|
|
else
|
2022-12-05 16:04:34 +01:00
|
|
|
echo "rc_branch_exists=0" >> $GITHUB_OUTPUT
|
2021-10-22 22:16:57 +02:00
|
|
|
fi
|
|
|
|
|
2022-03-09 21:46:24 +01:00
|
|
|
if [[ $(git ls-remote --heads origin hotfix-rc) ]]; then
|
2022-12-05 16:04:34 +01:00
|
|
|
echo "hotfix_branch_exists=1" >> $GITHUB_OUTPUT
|
2021-10-22 22:16:57 +02:00
|
|
|
else
|
2022-12-05 16:04:34 +01:00
|
|
|
echo "hotfix_branch_exists=0" >> $GITHUB_OUTPUT
|
2021-10-22 22:16:57 +02:00
|
|
|
fi
|
|
|
|
|
2024-02-28 13:48:16 +01:00
|
|
|
|
2020-06-05 19:51:57 +02:00
|
|
|
android:
|
2021-09-02 22:04:41 +02:00
|
|
|
name: Android
|
2022-08-04 18:35:17 +02:00
|
|
|
runs-on: windows-2022
|
2021-10-22 22:16:57 +02:00
|
|
|
needs: setup
|
2024-10-11 18:02:56 +02:00
|
|
|
if: false
|
2022-11-01 23:14:49 +01:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-01-10 19:48:22 +01:00
|
|
|
variant: ["prod", "qa"]
|
2024-02-08 20:05:26 +01:00
|
|
|
env:
|
2024-02-27 21:18:24 +01:00
|
|
|
android_folder_path: src\App\Platforms\Android
|
|
|
|
android_folder_path_bash: src/App/Platforms/Android
|
2020-06-05 19:51:57 +02:00
|
|
|
steps:
|
2024-10-10 11:51:28 +02:00
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2022-06-16 23:48:09 +02:00
|
|
|
- name: Setup NuGet
|
2024-05-06 16:18:57 +02:00
|
|
|
uses: nuget/setup-nuget@a21f25cd3998bf370fde17e3f1b4c12c175172f9 # v2.0.0
|
2022-06-16 23:48:09 +02:00
|
|
|
with:
|
2024-02-08 20:05:26 +01:00
|
|
|
nuget-version: 6.4.0
|
2022-06-16 23:48:09 +02:00
|
|
|
|
2023-07-13 16:05:57 +02:00
|
|
|
- name: Set up .NET
|
2024-07-16 21:06:47 +02:00
|
|
|
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
|
2023-07-13 16:05:57 +02:00
|
|
|
with:
|
2024-10-10 11:51:28 +02:00
|
|
|
dotnet-version: ${{ env.dotnet-version }}
|
|
|
|
|
|
|
|
- name: Install MAUI Workload
|
|
|
|
run: |
|
|
|
|
dotnet workload install maui --version ${{ env.maui-workload-version }}
|
2023-07-13 16:05:57 +02:00
|
|
|
|
2020-06-05 20:39:29 +02:00
|
|
|
- name: Set up MSBuild
|
2024-04-22 20:19:37 +02:00
|
|
|
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
|
2023-01-10 19:48:22 +01:00
|
|
|
|
2023-02-14 16:10:29 +01:00
|
|
|
- name: Setup Windows builder
|
|
|
|
run: choco install checksum --no-progress
|
|
|
|
|
2023-11-27 23:18:28 +01:00
|
|
|
- name: Install Microsoft OpenJDK 11
|
|
|
|
run: |
|
|
|
|
choco install microsoft-openjdk11 --no-progress
|
2024-02-27 21:18:24 +01:00
|
|
|
Write-Output "JAVA_HOME=$(Get-ChildItem -Path 'C:\Program Files\Microsoft\jdk*' | `
|
|
|
|
Select -First 1 -ExpandProperty FullName)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
2023-11-27 23:18:28 +01:00
|
|
|
Write-Output "Java Home: $env:JAVA_HOME"
|
|
|
|
|
2020-06-05 19:51:57 +02:00
|
|
|
- name: Print environment
|
|
|
|
run: |
|
2021-05-17 21:15:08 +02:00
|
|
|
nuget help | grep Version
|
2020-06-05 20:39:29 +02:00
|
|
|
msbuild -version
|
2020-06-09 15:58:28 +02:00
|
|
|
dotnet --info
|
2021-05-17 21:15:08 +02:00
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
2020-06-05 19:51:57 +02:00
|
|
|
|
2024-02-28 13:48:16 +01:00
|
|
|
- name: Login to Azure - CI Subscription
|
|
|
|
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
|
|
|
|
|
|
|
- name: Download secrets
|
2020-06-08 18:14:10 +02:00
|
|
|
env:
|
2024-02-28 13:48:16 +01:00
|
|
|
ACCOUNT_NAME: bitwardenci
|
|
|
|
CONTAINER_NAME: mobile
|
2021-09-24 19:50:54 +02:00
|
|
|
run: |
|
2024-02-27 21:18:24 +01:00
|
|
|
mkdir -p $HOME/secrets
|
2021-09-24 19:50:54 +02:00
|
|
|
|
2024-02-28 13:48:16 +01:00
|
|
|
az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME \
|
|
|
|
--name app_play-keystore.jks --file ./${{ env.android_folder_path_bash }}/app_play-keystore.jks --output none
|
|
|
|
az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME \
|
|
|
|
--name app_upload-keystore.jks --file ./${{ env.android_folder_path_bash }}/app_upload-keystore.jks --output none
|
|
|
|
az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME \
|
|
|
|
--name play_creds.json --file $HOME/secrets/play_creds.json --output none
|
2021-09-24 19:50:54 +02:00
|
|
|
shell: bash
|
2023-11-27 23:18:28 +01:00
|
|
|
|
2024-02-28 13:48:16 +01:00
|
|
|
- name: Download secrets - Google Services
|
2022-11-01 23:14:49 +01:00
|
|
|
if: ${{ matrix.variant == 'prod' }}
|
|
|
|
env:
|
2024-02-28 13:48:16 +01:00
|
|
|
ACCOUNT_NAME: bitwardenci
|
|
|
|
CONTAINER_NAME: mobile
|
2022-11-01 23:14:49 +01:00
|
|
|
run: |
|
2024-02-28 13:48:16 +01:00
|
|
|
az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME \
|
|
|
|
--name google-services.json --file ./${{ env.android_folder_path_bash }}/google-services.json --output none
|
2022-11-01 23:14:49 +01:00
|
|
|
shell: bash
|
2023-11-27 23:18:28 +01:00
|
|
|
|
2020-06-08 18:14:10 +02:00
|
|
|
- name: Increment version
|
2021-09-24 19:50:54 +02:00
|
|
|
run: |
|
2024-07-03 04:02:31 +02:00
|
|
|
BUILD_NUMBER=$((11000 + $GITHUB_RUN_NUMBER))
|
2024-03-14 17:06:51 +01:00
|
|
|
echo "##### Setting Android Version Code to $BUILD_NUMBER" | tee -a $GITHUB_STEP_SUMMARY
|
2024-03-04 16:11:54 +01:00
|
|
|
|
2021-09-24 23:02:34 +02:00
|
|
|
sed -i "s/android:versionCode=\"1\"/android:versionCode=\"$BUILD_NUMBER\"/" \
|
2024-02-27 21:18:24 +01:00
|
|
|
./${{ env.android_folder_path_bash }}/AndroidManifest.xml
|
2021-09-24 19:50:54 +02:00
|
|
|
shell: bash
|
2020-06-08 18:14:10 +02:00
|
|
|
|
2020-06-05 21:23:15 +02:00
|
|
|
- name: Restore packages
|
|
|
|
run: nuget restore
|
|
|
|
|
2022-04-26 17:21:07 +02:00
|
|
|
- name: Restore tools
|
|
|
|
run: dotnet tool restore
|
|
|
|
|
2024-02-27 21:18:24 +01:00
|
|
|
# - name: Run Core tests
|
|
|
|
# run: |
|
|
|
|
# dotnet test test/Core.Test/Core.Test.csproj --logger "trx;LogFileName=test-results.trx" `
|
|
|
|
# /p:CustomConstants=UT
|
2022-04-26 17:21:07 +02:00
|
|
|
|
2024-02-27 21:18:24 +01:00
|
|
|
# - name: Report test results
|
|
|
|
# uses: dorny/test-reporter@eaa763f6ffc21c7a37837f56cd5f9737f27fc6c8 # v1.8.0
|
|
|
|
# if: always()
|
|
|
|
# with:
|
|
|
|
# name: Test Results
|
|
|
|
# path: "**/test-results.trx"
|
|
|
|
# reporter: dotnet-trx
|
|
|
|
# fail-on-error: true
|
2021-01-25 21:27:38 +01:00
|
|
|
|
2020-06-09 16:47:20 +02:00
|
|
|
- name: Build Play Store publisher
|
2022-11-01 23:14:49 +01:00
|
|
|
if: ${{ matrix.variant == 'prod' }}
|
2024-02-27 21:18:24 +01:00
|
|
|
run: dotnet build .\store\google\Publisher\Publisher.csproj /p:Configuration=Release
|
2020-06-09 16:47:20 +02:00
|
|
|
|
2022-11-01 23:14:49 +01:00
|
|
|
- name: Setup Android build (${{ matrix.variant }})
|
|
|
|
run: dotnet cake build.cake --target Android --variant ${{ matrix.variant }}
|
|
|
|
|
2024-02-27 21:18:24 +01:00
|
|
|
- name: Build & Sign Android
|
2020-06-08 18:14:10 +02:00
|
|
|
env:
|
|
|
|
PLAY_KEYSTORE_PASSWORD: ${{ secrets.PLAY_KEYSTORE_PASSWORD }}
|
|
|
|
UPLOAD_KEYSTORE_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_PASSWORD }}
|
2021-09-24 19:50:54 +02:00
|
|
|
run: |
|
2024-02-27 21:18:24 +01:00
|
|
|
$projToBuild = "$($env:GITHUB_WORKSPACE)/${{ env.main_app_project_path }}";
|
2022-11-01 23:14:49 +01:00
|
|
|
$packageName = "com.x8bit.bitwarden";
|
2023-01-10 19:48:22 +01:00
|
|
|
|
2023-04-11 17:18:59 +02:00
|
|
|
if ("${{ matrix.variant }}" -ne "prod")
|
2022-11-01 23:14:49 +01:00
|
|
|
{
|
|
|
|
$packageName = "com.x8bit.bitwarden.${{ matrix.variant }}";
|
|
|
|
}
|
2021-09-24 19:50:54 +02:00
|
|
|
Write-Output "##### Sign Google Play Bundle Release Configuration"
|
|
|
|
|
2024-02-27 21:18:24 +01:00
|
|
|
$signingUploadKeyStore = "$($env:GITHUB_WORKSPACE)\${{ env.android_folder_path }}\app_upload-keystore.jks"
|
|
|
|
dotnet publish $projToBuild -c Release -f ${{ env.target-net-version }}-android `
|
|
|
|
/p:AndroidPackageFormats=aab `
|
|
|
|
/p:AndroidKeyStore=true `
|
|
|
|
/p:AndroidSigningKeyStore=$signingUploadKeyStore `
|
|
|
|
/p:AndroidSigningKeyAlias=upload `
|
|
|
|
/p:AndroidSigningKeyPass="$($env:UPLOAD_KEYSTORE_PASSWORD)" `
|
|
|
|
/p:AndroidSigningStorePass="$($env:UPLOAD_KEYSTORE_PASSWORD)" --no-restore
|
2021-09-24 19:50:54 +02:00
|
|
|
|
|
|
|
Write-Output "##### Copy Google Play Bundle to project root"
|
|
|
|
|
2024-02-27 21:18:24 +01:00
|
|
|
$signedAabPath = "$($env:GITHUB_WORKSPACE)\${{ env.main_app_folder_path }}\bin\Release\${{ env.target-net-version }}-android\publish\$($packageName)-Signed.aab";
|
|
|
|
$signedAabDestPath = "$($env:GITHUB_WORKSPACE)\$($packageName).aab";
|
2021-09-24 19:50:54 +02:00
|
|
|
Copy-Item $signedAabPath $signedAabDestPath
|
|
|
|
|
|
|
|
Write-Output "##### Sign APK Release Configuration"
|
|
|
|
|
2024-02-27 21:18:24 +01:00
|
|
|
$signingPlayKeyStore = "$($env:GITHUB_WORKSPACE)\${{ env.android_folder_path }}\app_play-keystore.jks"
|
|
|
|
dotnet publish $projToBuild -c Release -f ${{ env.target-net-version }}-android `
|
|
|
|
/p:AndroidKeyStore=true `
|
|
|
|
/p:AndroidSigningKeyStore=$signingPlayKeyStore `
|
|
|
|
/p:AndroidSigningKeyAlias=bitwarden `
|
|
|
|
/p:AndroidSigningKeyPass="$($env:PLAY_KEYSTORE_PASSWORD)" `
|
|
|
|
/p:AndroidSigningStorePass="$($env:PLAY_KEYSTORE_PASSWORD)" --no-restore
|
2021-09-24 19:50:54 +02:00
|
|
|
|
|
|
|
Write-Output "##### Copy Release APK to project root"
|
|
|
|
|
2024-02-27 21:18:24 +01:00
|
|
|
$signedApkPath = "$($env:GITHUB_WORKSPACE)\${{ env.main_app_folder_path }}\bin\Release\${{ env.target-net-version }}-android\publish\$($packageName)-Signed.apk";
|
|
|
|
$signedApkDestPath = "$($env:GITHUB_WORKSPACE)\$($packageName).apk";
|
2021-09-24 19:50:54 +02:00
|
|
|
Copy-Item $signedApkPath $signedApkDestPath
|
2023-11-27 23:18:28 +01:00
|
|
|
|
2022-11-01 23:14:49 +01:00
|
|
|
- name: Upload Prod .aab artifact
|
|
|
|
if: ${{ matrix.variant == 'prod' }}
|
2024-07-16 21:06:47 +02:00
|
|
|
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
|
2020-06-08 18:14:10 +02:00
|
|
|
with:
|
|
|
|
name: com.x8bit.bitwarden.aab
|
|
|
|
path: ./com.x8bit.bitwarden.aab
|
2021-09-24 19:50:54 +02:00
|
|
|
if-no-files-found: error
|
2020-06-05 19:51:57 +02:00
|
|
|
|
2022-11-01 23:14:49 +01:00
|
|
|
- name: Upload Prod .apk artifact
|
|
|
|
if: ${{ matrix.variant == 'prod' }}
|
2024-07-16 21:06:47 +02:00
|
|
|
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
|
2020-06-08 18:14:10 +02:00
|
|
|
with:
|
|
|
|
name: com.x8bit.bitwarden.apk
|
|
|
|
path: ./com.x8bit.bitwarden.apk
|
2021-09-24 19:50:54 +02:00
|
|
|
if-no-files-found: error
|
2020-06-08 18:14:10 +02:00
|
|
|
|
2022-11-01 23:14:49 +01:00
|
|
|
- name: Upload Other .apk artifact
|
|
|
|
if: ${{ matrix.variant != 'prod' }}
|
2024-07-16 21:06:47 +02:00
|
|
|
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
|
2022-11-01 23:14:49 +01:00
|
|
|
with:
|
|
|
|
name: com.x8bit.bitwarden.${{ matrix.variant }}.apk
|
|
|
|
path: ./com.x8bit.bitwarden.${{ matrix.variant }}.apk
|
|
|
|
if-no-files-found: error
|
|
|
|
|
2023-02-14 16:10:29 +01:00
|
|
|
- name: Create checksum for Prod .apk artifact
|
|
|
|
if: ${{ matrix.variant == 'prod' }}
|
|
|
|
run: |
|
|
|
|
checksum -f="./com.x8bit.bitwarden.apk" `
|
|
|
|
-t sha256 | Out-File -Encoding ASCII ./bw-android-apk-sha256.txt
|
|
|
|
|
|
|
|
- name: Create checksum for Other .apk artifact
|
|
|
|
if: ${{ matrix.variant != 'prod' }}
|
|
|
|
run: |
|
|
|
|
checksum -f="./com.x8bit.bitwarden.${{ matrix.variant }}.apk" `
|
|
|
|
-t sha256 | Out-File -Encoding ASCII ./bw-android-${{ matrix.variant }}-apk-sha256.txt
|
|
|
|
|
|
|
|
- name: Upload .apk sha file for prod
|
|
|
|
if: ${{ matrix.variant == 'prod' }}
|
2024-07-16 21:06:47 +02:00
|
|
|
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
|
2023-02-14 16:10:29 +01:00
|
|
|
with:
|
|
|
|
name: bw-android-apk-sha256.txt
|
|
|
|
path: ./bw-android-apk-sha256.txt
|
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: Upload .apk sha file for other
|
|
|
|
if: ${{ matrix.variant != 'prod' }}
|
2024-07-16 21:06:47 +02:00
|
|
|
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
|
2023-02-14 16:10:29 +01:00
|
|
|
with:
|
|
|
|
name: bw-android-${{ matrix.variant }}-apk-sha256.txt
|
|
|
|
path: ./bw-android-${{ matrix.variant }}-apk-sha256.txt
|
|
|
|
if-no-files-found: error
|
|
|
|
|
2020-06-09 16:21:46 +02:00
|
|
|
- name: Deploy to Play Store
|
2023-12-12 20:12:27 +01:00
|
|
|
if: ${{ matrix.variant == 'prod' && (( github.ref == 'refs/heads/main'
|
2022-11-01 23:14:49 +01:00
|
|
|
&& needs.setup.outputs.rc_branch_exists == 0
|
|
|
|
&& needs.setup.outputs.hotfix_branch_exists == 0)
|
|
|
|
|| (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0)
|
|
|
|
|| github.ref == 'refs/heads/hotfix-rc' ) }}
|
2020-07-06 15:50:26 +02:00
|
|
|
run: |
|
2024-02-27 21:18:24 +01:00
|
|
|
$publisherPath = "$($env:GITHUB_WORKSPACE)\store\google\Publisher\bin\Release\net8.0\Publisher.dll"
|
|
|
|
$credsPath = "$($HOME)\secrets\play_creds.json"
|
|
|
|
$aabPath = "$($env:GITHUB_WORKSPACE)\com.x8bit.bitwarden.aab"
|
|
|
|
$track = "internal"
|
2021-09-24 19:50:54 +02:00
|
|
|
|
2024-02-27 21:18:24 +01:00
|
|
|
dotnet $publisherPath $credsPath $aabPath $track
|
2021-09-02 22:04:41 +02:00
|
|
|
|
2020-07-06 15:50:26 +02:00
|
|
|
|
2021-09-24 19:50:54 +02:00
|
|
|
f-droid:
|
|
|
|
name: F-Droid Build
|
2022-08-04 18:35:17 +02:00
|
|
|
runs-on: windows-2022
|
2024-10-11 18:02:56 +02:00
|
|
|
if: false
|
2024-02-08 20:05:26 +01:00
|
|
|
env:
|
2024-03-08 00:45:15 +01:00
|
|
|
android_folder_path: src\App\Platforms\Android
|
|
|
|
android_folder_path_bash: src/App/Platforms/Android
|
2024-02-08 20:05:26 +01:00
|
|
|
android_manifest_path: src/App/Platforms/Android/AndroidManifest.xml
|
2020-07-06 15:50:26 +02:00
|
|
|
steps:
|
2024-10-10 11:51:28 +02:00
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2022-06-16 23:48:09 +02:00
|
|
|
- name: Setup NuGet
|
2024-05-06 16:18:57 +02:00
|
|
|
uses: nuget/setup-nuget@a21f25cd3998bf370fde17e3f1b4c12c175172f9 # v2.0.0
|
2022-06-16 23:48:09 +02:00
|
|
|
with:
|
2024-02-08 20:05:26 +01:00
|
|
|
nuget-version: 6.4.0
|
|
|
|
|
|
|
|
- name: Set up .NET
|
2024-07-16 21:06:47 +02:00
|
|
|
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
|
2024-02-08 20:05:26 +01:00
|
|
|
with:
|
2024-10-10 11:51:28 +02:00
|
|
|
dotnet-version: ${{ env.dotnet-version }}
|
|
|
|
|
|
|
|
- name: Install MAUI Workload
|
|
|
|
run: |
|
|
|
|
dotnet workload install maui --version ${{ env.maui-workload-version }}
|
2022-06-16 23:48:09 +02:00
|
|
|
|
2021-09-24 19:50:54 +02:00
|
|
|
- name: Set up MSBuild
|
2024-04-22 20:19:37 +02:00
|
|
|
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
|
2020-07-06 15:50:26 +02:00
|
|
|
|
2023-02-14 16:10:29 +01:00
|
|
|
- name: Setup Windows builder
|
|
|
|
run: choco install checksum --no-progress
|
|
|
|
|
2023-11-27 23:18:28 +01:00
|
|
|
- name: Install Microsoft OpenJDK 11
|
|
|
|
run: |
|
|
|
|
choco install microsoft-openjdk11 --no-progress
|
|
|
|
Write-Output "JAVA_HOME=$(Get-ChildItem -Path 'C:\Program Files\Microsoft\jdk*' | Select -First 1 -ExpandProperty FullName)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
|
|
Write-Output "Java Home: $env:JAVA_HOME"
|
2022-08-16 18:46:54 +02:00
|
|
|
|
2021-09-24 19:50:54 +02:00
|
|
|
- name: Print environment
|
2020-07-06 15:50:26 +02:00
|
|
|
run: |
|
2021-09-24 19:50:54 +02:00
|
|
|
nuget help | grep Version
|
|
|
|
msbuild -version
|
|
|
|
dotnet --info
|
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
2020-07-06 15:50:26 +02:00
|
|
|
|
2024-02-28 13:48:16 +01:00
|
|
|
- name: Login to Azure - CI Subscription
|
|
|
|
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
|
|
|
|
|
|
|
- name: Download secrets
|
2020-07-06 15:50:26 +02:00
|
|
|
env:
|
2024-02-28 13:48:16 +01:00
|
|
|
ACCOUNT_NAME: bitwardenci
|
|
|
|
CONTAINER_NAME: mobile
|
|
|
|
FILE: app_fdroid-keystore.jks
|
2020-07-06 15:50:26 +02:00
|
|
|
run: |
|
2024-02-28 13:48:16 +01:00
|
|
|
az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME --name $FILE \
|
2024-03-08 00:45:15 +01:00
|
|
|
--file ${{ env.android_folder_path_bash }}/$FILE --output none
|
2021-09-24 19:50:54 +02:00
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Increment version
|
2020-07-06 15:50:26 +02:00
|
|
|
run: |
|
2024-07-03 04:02:31 +02:00
|
|
|
BUILD_NUMBER=$((11000 + $GITHUB_RUN_NUMBER))
|
2024-03-14 17:06:51 +01:00
|
|
|
echo "##### Setting F-Droid Version Code to $BUILD_NUMBER" | tee -a $GITHUB_STEP_SUMMARY
|
2020-07-06 15:50:26 +02:00
|
|
|
|
2021-10-28 15:49:29 +02:00
|
|
|
sed -i "s/android:versionCode=\"1\"/android:versionCode=\"$BUILD_NUMBER\"/" \
|
2024-02-08 20:05:26 +01:00
|
|
|
./${{ env.android_manifest_path }}
|
2021-09-24 19:50:54 +02:00
|
|
|
shell: bash
|
2020-07-06 15:50:26 +02:00
|
|
|
|
2021-09-24 19:50:54 +02:00
|
|
|
- name: Clean for F-Droid
|
2020-07-06 15:50:26 +02:00
|
|
|
run: |
|
2024-03-15 21:01:15 +01:00
|
|
|
$directoryBuildProps = $($env:GITHUB_WORKSPACE + "/Directory.Build.props");
|
2021-09-24 19:50:54 +02:00
|
|
|
|
2024-02-08 20:05:26 +01:00
|
|
|
$androidManifest = $($env:GITHUB_WORKSPACE + "/${{ env.android_manifest_path }}");
|
2021-09-24 19:50:54 +02:00
|
|
|
|
2024-02-28 13:48:16 +01:00
|
|
|
Write-Output "##### Back up project files"
|
2021-09-24 19:50:54 +02:00
|
|
|
|
|
|
|
Copy-Item $androidManifest $($androidManifest + ".original");
|
2024-03-15 21:01:15 +01:00
|
|
|
Copy-Item $directoryBuildProps $($directoryBuildProps + ".original");
|
2021-09-24 19:50:54 +02:00
|
|
|
|
|
|
|
Write-Output "##### Cleanup Android Manifest"
|
|
|
|
|
|
|
|
$xml=New-Object XML;
|
|
|
|
$xml.Load($androidManifest);
|
|
|
|
|
|
|
|
$nsAndroid=New-Object System.Xml.XmlNamespaceManager($xml.NameTable);
|
|
|
|
$nsAndroid.AddNamespace("android", "http://schemas.android.com/apk/res/android");
|
|
|
|
|
|
|
|
$xml.Save($androidManifest);
|
|
|
|
|
2024-03-15 21:01:15 +01:00
|
|
|
Write-Output "##### Enabling FDROID constant"
|
|
|
|
|
|
|
|
(Get-Content $directoryBuildProps).Replace('<!-- <CustomConstants>FDROID</CustomConstants> -->', '<CustomConstants>FDROID</CustomConstants>') | Set-Content $directoryBuildProps
|
|
|
|
|
2021-09-24 19:50:54 +02:00
|
|
|
- name: Restore packages
|
2024-02-08 20:05:26 +01:00
|
|
|
run: dotnet restore
|
2021-09-24 19:50:54 +02:00
|
|
|
|
2024-03-08 00:45:15 +01:00
|
|
|
- name: Build & Sign F-Droid
|
2020-07-06 15:50:26 +02:00
|
|
|
env:
|
2021-09-24 19:50:54 +02:00
|
|
|
FDROID_KEYSTORE_PASSWORD: ${{ secrets.FDROID_KEYSTORE_PASSWORD }}
|
|
|
|
run: |
|
2024-03-08 00:45:15 +01:00
|
|
|
$projToBuild = "$($env:GITHUB_WORKSPACE)\${{ env.main_app_project_path }}";
|
2024-02-08 20:05:26 +01:00
|
|
|
$packageName = "com.x8bit.bitwarden";
|
|
|
|
|
|
|
|
Write-Output "##### Sign FDroid"
|
2021-09-24 19:50:54 +02:00
|
|
|
|
2024-03-08 00:45:15 +01:00
|
|
|
$signingFdroidKeyStore = "$($env:GITHUB_WORKSPACE)\${{ env.android_folder_path }}\app_fdroid-keystore.jks"
|
2024-03-15 21:01:15 +01:00
|
|
|
dotnet build $projToBuild -c Release -f ${{ env.target-net-version }}-android `
|
2024-03-08 00:45:15 +01:00
|
|
|
/p:AndroidKeyStore=true `
|
|
|
|
/p:AndroidSigningKeyStore=$signingFdroidKeyStore `
|
|
|
|
/p:AndroidSigningKeyAlias=bitwarden `
|
|
|
|
/p:AndroidSigningKeyPass="$($env:FDROID_KEYSTORE_PASSWORD)" `
|
2024-03-15 21:01:15 +01:00
|
|
|
/p:AndroidSigningStorePass="$($env:FDROID_KEYSTORE_PASSWORD)" ` --no-restore
|
2021-09-24 19:50:54 +02:00
|
|
|
|
|
|
|
Write-Output "##### Copy FDroid apk to project root"
|
|
|
|
|
2024-03-15 21:01:15 +01:00
|
|
|
$signedApkPath = "$($env:GITHUB_WORKSPACE)\${{ env.main_app_folder_path }}\bin\Release\${{ env.target-net-version }}-android\$($packageName)-Signed.apk";
|
2024-03-08 00:45:15 +01:00
|
|
|
$signedApkDestPath = "$($env:GITHUB_WORKSPACE)\com.x8bit.bitwarden-fdroid.apk";
|
2021-09-24 19:50:54 +02:00
|
|
|
|
|
|
|
Copy-Item $signedApkPath $signedApkDestPath
|
|
|
|
|
|
|
|
- name: Upload F-Droid .apk artifact
|
2024-07-16 21:06:47 +02:00
|
|
|
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
|
2021-09-24 19:50:54 +02:00
|
|
|
with:
|
|
|
|
name: com.x8bit.bitwarden-fdroid.apk
|
|
|
|
path: ./com.x8bit.bitwarden-fdroid.apk
|
|
|
|
if-no-files-found: error
|
2020-07-06 15:50:26 +02:00
|
|
|
|
2023-02-14 16:10:29 +01:00
|
|
|
- name: Create checksum for F-Droid artifact
|
|
|
|
run: |
|
|
|
|
checksum -f="./com.x8bit.bitwarden-fdroid.apk" `
|
|
|
|
-t sha256 | Out-File -Encoding ASCII ./bw-fdroid-apk-sha256.txt
|
|
|
|
|
|
|
|
- name: Upload F-Droid sha file
|
2024-07-16 21:06:47 +02:00
|
|
|
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
|
2023-02-14 16:10:29 +01:00
|
|
|
with:
|
|
|
|
name: bw-fdroid-apk-sha256.txt
|
|
|
|
path: ./bw-fdroid-apk-sha256.txt
|
|
|
|
if-no-files-found: error
|
|
|
|
|
2024-02-27 21:18:24 +01:00
|
|
|
|
2020-06-08 18:14:10 +02:00
|
|
|
ios:
|
2021-09-02 22:04:41 +02:00
|
|
|
name: Apple iOS
|
2024-04-29 16:23:30 +02:00
|
|
|
runs-on: macos-14
|
2021-10-22 22:16:57 +02:00
|
|
|
needs: setup
|
2024-02-08 20:05:26 +01:00
|
|
|
env:
|
|
|
|
ios_folder_path: src/App/Platforms/iOS
|
|
|
|
app_output_name: App
|
|
|
|
app_ci_output_filename: App_x64_Debug
|
2020-06-05 19:51:57 +02:00
|
|
|
steps:
|
2024-10-10 11:51:28 +02:00
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
|
|
with:
|
|
|
|
submodules: 'true'
|
|
|
|
|
2024-02-08 20:05:26 +01:00
|
|
|
- name: Set XCode version
|
|
|
|
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
|
|
|
|
with:
|
2024-10-10 11:51:28 +02:00
|
|
|
xcode-version: 15.4
|
2024-02-08 20:05:26 +01:00
|
|
|
|
2022-06-16 23:48:09 +02:00
|
|
|
- name: Setup NuGet
|
2024-05-06 16:18:57 +02:00
|
|
|
uses: nuget/setup-nuget@a21f25cd3998bf370fde17e3f1b4c12c175172f9 # v2.0.0
|
2022-06-16 23:48:09 +02:00
|
|
|
with:
|
2024-02-08 20:05:26 +01:00
|
|
|
nuget-version: 6.4.0
|
2024-03-04 16:11:54 +01:00
|
|
|
|
2024-02-08 20:05:26 +01:00
|
|
|
- name: Set up .NET
|
2024-07-16 21:06:47 +02:00
|
|
|
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
|
2024-02-08 20:05:26 +01:00
|
|
|
with:
|
2024-10-10 11:51:28 +02:00
|
|
|
dotnet-version: ${{ env.dotnet-version }}
|
2024-03-04 16:11:54 +01:00
|
|
|
|
2024-02-08 20:05:26 +01:00
|
|
|
- name: Install MAUI Workload
|
2024-10-10 11:51:28 +02:00
|
|
|
run: dotnet workload install maui --version ${{ env.maui-workload-version }}
|
2022-06-16 23:48:09 +02:00
|
|
|
|
2020-06-05 19:51:57 +02:00
|
|
|
- name: Print environment
|
|
|
|
run: |
|
2021-05-17 21:15:08 +02:00
|
|
|
nuget help | grep Version
|
2020-06-09 15:58:28 +02:00
|
|
|
dotnet --info
|
2021-05-17 21:15:08 +02:00
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
2020-06-05 19:51:57 +02:00
|
|
|
|
2023-04-18 12:48:05 +02:00
|
|
|
- name: Login to Azure - CI Subscription
|
2024-01-24 16:07:10 +01:00
|
|
|
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
2022-02-14 20:06:35 +01:00
|
|
|
with:
|
2023-04-11 17:18:59 +02:00
|
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
2022-02-14 20:06:35 +01:00
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2023-11-27 23:18:28 +01:00
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-ci"
|
|
|
|
secrets: "appcenter-ios-token"
|
2022-02-14 20:06:35 +01:00
|
|
|
|
2024-02-28 13:48:16 +01:00
|
|
|
- name: Download Provisioning Profiles secrets
|
2020-06-09 16:47:09 +02:00
|
|
|
env:
|
2024-02-28 13:48:16 +01:00
|
|
|
ACCOUNT_NAME: bitwardenci
|
|
|
|
CONTAINER_NAME: profiles
|
|
|
|
run: |
|
|
|
|
mkdir -p $HOME/secrets
|
|
|
|
profiles=(
|
|
|
|
"dist_autofill.mobileprovision"
|
|
|
|
"dist_bitwarden.mobileprovision"
|
|
|
|
"dist_extension.mobileprovision"
|
|
|
|
"dist_share_extension.mobileprovision"
|
|
|
|
"dist_bitwarden_watch_app.mobileprovision"
|
|
|
|
"dist_bitwarden_watch_app_extension.mobileprovision"
|
|
|
|
)
|
|
|
|
|
|
|
|
for FILE in "${profiles[@]}"
|
|
|
|
do
|
|
|
|
az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME --name $FILE \
|
|
|
|
--file $HOME/secrets/$FILE --output none
|
|
|
|
done
|
|
|
|
|
|
|
|
- name: Download Google Services secret
|
|
|
|
env:
|
|
|
|
ACCOUNT_NAME: bitwardenci
|
|
|
|
CONTAINER_NAME: mobile
|
|
|
|
FILE: GoogleService-Info.plist
|
|
|
|
run: |
|
|
|
|
mkdir -p $HOME/secrets
|
|
|
|
az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME --name $FILE \
|
2024-03-04 16:11:54 +01:00
|
|
|
--file src/watchOS/bitwarden/$FILE --output none
|
2020-06-09 16:47:09 +02:00
|
|
|
|
2020-06-10 03:23:10 +02:00
|
|
|
- name: Increment version
|
2021-09-24 19:50:54 +02:00
|
|
|
run: |
|
2024-07-03 04:02:31 +02:00
|
|
|
BUILD_NUMBER=$((8000 + $GITHUB_RUN_NUMBER))
|
2024-03-14 17:06:51 +01:00
|
|
|
echo "##### Setting iOS CFBundleVersion to $BUILD_NUMBER" | tee -a $GITHUB_STEP_SUMMARY
|
2024-02-09 11:31:25 +01:00
|
|
|
|
2024-02-08 20:05:26 +01:00
|
|
|
perl -0777 -pi.bak -e 's/<key>CFBundleVersion<\/key>\s*<string>1<\/string>/<key>CFBundleVersion<\/key>\n\t<string>'"$BUILD_NUMBER"'<\/string>/' ./${{ env.ios_folder_path }}/Info.plist
|
2021-09-24 19:50:54 +02:00
|
|
|
perl -0777 -pi.bak -e 's/<key>CFBundleVersion<\/key>\s*<string>1<\/string>/<key>CFBundleVersion<\/key>\n\t<string>'"$BUILD_NUMBER"'<\/string>/' ./src/iOS.Extension/Info.plist
|
|
|
|
perl -0777 -pi.bak -e 's/<key>CFBundleVersion<\/key>\s*<string>1<\/string>/<key>CFBundleVersion<\/key>\n\t<string>'"$BUILD_NUMBER"'<\/string>/' ./src/iOS.Autofill/Info.plist
|
2022-01-25 21:41:56 +01:00
|
|
|
perl -0777 -pi.bak -e 's/<key>CFBundleVersion<\/key>\s*<string>1<\/string>/<key>CFBundleVersion<\/key>\n\t<string>'"$BUILD_NUMBER"'<\/string>/' ./src/iOS.ShareExtension/Info.plist
|
2022-12-07 17:39:20 +01:00
|
|
|
cd src/watchOS/bitwarden
|
2024-02-28 13:48:16 +01:00
|
|
|
agvtool new-version -all $BUILD_NUMBER
|
2021-09-24 19:50:54 +02:00
|
|
|
|
2022-01-18 15:52:08 +01:00
|
|
|
- name: Update Entitlements
|
|
|
|
run: |
|
|
|
|
echo "##### Updating Entitlements"
|
2024-02-08 20:05:26 +01:00
|
|
|
perl -0777 -pi.bak -e 's/<key>aps-environment<\/key>\s*<string>development<\/string>/<key>aps-environment<\/key>\n\t<string>production<\/string>/' ./${{ env.ios_folder_path }}/Entitlements.plist
|
2024-02-28 13:48:16 +01:00
|
|
|
|
|
|
|
- name: Get certificates
|
|
|
|
run: |
|
|
|
|
mkdir -p $HOME/certificates
|
|
|
|
az keyvault secret show --id https://bitwarden-ci.vault.azure.net/certificates/ios-distribution |
|
|
|
|
jq -r .value | base64 -d > $HOME/certificates/ios-distribution.p12
|
2024-03-04 16:11:54 +01:00
|
|
|
|
2021-09-24 19:50:54 +02:00
|
|
|
- name: Set up Keychain
|
2020-06-09 17:37:40 +02:00
|
|
|
env:
|
|
|
|
KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEYCHAIN_PASSWORD }}
|
2021-09-24 19:50:54 +02:00
|
|
|
run: |
|
|
|
|
security create-keychain -p $KEYCHAIN_PASSWORD build.keychain
|
|
|
|
security default-keychain -s build.keychain
|
|
|
|
security unlock-keychain -p $KEYCHAIN_PASSWORD build.keychain
|
|
|
|
security set-keychain-settings -lut 1200 build.keychain
|
2024-02-28 13:48:16 +01:00
|
|
|
|
|
|
|
security import $HOME/certificates/ios-distribution.p12 -k build.keychain -P "" -T /usr/bin/codesign \
|
|
|
|
-T /usr/bin/security
|
2021-09-24 19:50:54 +02:00
|
|
|
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain
|
2020-06-09 17:37:40 +02:00
|
|
|
|
2020-06-09 18:25:09 +02:00
|
|
|
- name: Set up provisioning profiles
|
2021-09-24 19:50:54 +02:00
|
|
|
run: |
|
|
|
|
AUTOFILL_PROFILE_PATH=$HOME/secrets/dist_autofill.mobileprovision
|
|
|
|
BITWARDEN_PROFILE_PATH=$HOME/secrets/dist_bitwarden.mobileprovision
|
|
|
|
EXTENSION_PROFILE_PATH=$HOME/secrets/dist_extension.mobileprovision
|
2022-01-25 21:41:56 +01:00
|
|
|
SHARE_EXTENSION_PROFILE_PATH=$HOME/secrets/dist_share_extension.mobileprovision
|
2024-02-28 13:48:16 +01:00
|
|
|
WATCH_APP_PROFILE_PATH=$HOME/secrets/dist_bitwarden_watch_app.mobileprovision
|
|
|
|
WATCH_APP_EXTENSION_PROFILE_PATH=$HOME/secrets/dist_bitwarden_watch_app_extension.mobileprovision
|
2021-09-24 19:50:54 +02:00
|
|
|
PROFILES_DIR_PATH=$HOME/Library/MobileDevice/Provisioning\ Profiles
|
|
|
|
|
|
|
|
mkdir -p "$PROFILES_DIR_PATH"
|
|
|
|
|
|
|
|
AUTOFILL_UUID=$(grep UUID -A1 -a $AUTOFILL_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
|
|
|
|
cp $AUTOFILL_PROFILE_PATH "$PROFILES_DIR_PATH/$AUTOFILL_UUID.mobileprovision"
|
|
|
|
|
|
|
|
BITWARDEN_UUID=$(grep UUID -A1 -a $BITWARDEN_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
|
|
|
|
cp $BITWARDEN_PROFILE_PATH "$PROFILES_DIR_PATH/$BITWARDEN_UUID.mobileprovision"
|
|
|
|
|
|
|
|
EXTENSION_UUID=$(grep UUID -A1 -a $EXTENSION_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
|
|
|
|
cp $EXTENSION_PROFILE_PATH "$PROFILES_DIR_PATH/$EXTENSION_UUID.mobileprovision"
|
2022-01-25 21:41:56 +01:00
|
|
|
|
|
|
|
SHARE_EXTENSION_UUID=$(grep UUID -A1 -a $SHARE_EXTENSION_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
|
|
|
|
cp $SHARE_EXTENSION_PROFILE_PATH "$PROFILES_DIR_PATH/$SHARE_EXTENSION_UUID.mobileprovision"
|
2022-12-07 17:39:20 +01:00
|
|
|
|
|
|
|
WATCH_APP_UUID=$(grep UUID -A1 -a $WATCH_APP_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
|
|
|
|
cp $WATCH_APP_PROFILE_PATH "$PROFILES_DIR_PATH/$WATCH_APP_UUID.mobileprovision"
|
|
|
|
|
|
|
|
WATCH_APP_EXTENSION_UUID=$(grep UUID -A1 -a $WATCH_APP_EXTENSION_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
|
|
|
|
cp $WATCH_APP_EXTENSION_PROFILE_PATH "$PROFILES_DIR_PATH/$WATCH_APP_EXTENSION_UUID.mobileprovision"
|
|
|
|
|
2024-02-08 20:05:26 +01:00
|
|
|
- name: Restore packages
|
|
|
|
run: dotnet restore
|
|
|
|
|
2022-12-07 17:39:20 +01:00
|
|
|
- name: Bulid WatchApp
|
|
|
|
run: |
|
|
|
|
echo "##### Build WatchApp with Release Configuration"
|
|
|
|
xcodebuild archive -workspace ./src/watchOS/bitwarden/bitwarden.xcodeproj/project.xcworkspace -configuration Release -scheme bitwarden\ WatchKit\ App -archivePath ./src/watchOS/bitwarden
|
|
|
|
|
2020-06-10 15:03:12 +02:00
|
|
|
- name: Archive Build for App Store
|
2021-09-24 19:50:54 +02:00
|
|
|
run: |
|
2024-02-28 13:48:16 +01:00
|
|
|
echo "##### Archive for Release ios-arm64"
|
2024-02-08 20:05:26 +01:00
|
|
|
dotnet publish ${{ env.main_app_project_path }} -c Release -f ${{ env.target-net-version }}-ios /p:RuntimeIdentifier=ios-arm64 /p:ArchiveOnBuild=true /p:MtouchUseLlvm=false
|
2023-09-06 19:25:59 +02:00
|
|
|
|
|
|
|
- name: Archive Build for Mobile Automation
|
|
|
|
run: |
|
2024-02-28 13:48:16 +01:00
|
|
|
echo "##### Archive Debug for iossimulator-x64"
|
2024-02-08 20:05:26 +01:00
|
|
|
dotnet build ${{ env.main_app_project_path }} -c Debug -f ${{ env.target-net-version }}-ios /p:RuntimeIdentifier=iossimulator-x64 /p:ArchiveOnBuild=true /p:MtouchUseLlvm=false
|
2024-02-28 13:48:16 +01:00
|
|
|
ls $HOME/Library/Developer/Xcode/Archives
|
2020-06-10 16:02:15 +02:00
|
|
|
|
|
|
|
- name: Export .ipa for App Store
|
2024-02-28 13:48:16 +01:00
|
|
|
env:
|
|
|
|
EXPORT_OPTIONS_PATH: ./.github/resources/export-options-app-store.plist
|
|
|
|
EXPORT_PATH: ./bitwarden-export
|
2021-09-24 19:50:54 +02:00
|
|
|
run: |
|
|
|
|
ARCHIVE_PATH="$HOME/Library/Developer/Xcode/Archives/*/*.xcarchive"
|
|
|
|
xcodebuild -exportArchive -archivePath $ARCHIVE_PATH -exportPath $EXPORT_PATH \
|
|
|
|
-exportOptionsPlist $EXPORT_OPTIONS_PATH
|
2020-06-10 16:53:57 +02:00
|
|
|
|
2023-09-06 19:25:59 +02:00
|
|
|
- name: Export .app for Automation CI
|
2024-02-28 13:48:16 +01:00
|
|
|
env:
|
|
|
|
ARCHIVE_PATH: ./${{ env.main_app_folder_path }}/bin/Debug/${{ env.target-net-version }}-ios/iossimulator-x64
|
|
|
|
EXPORT_PATH: ./bitwarden-export
|
2023-09-06 19:25:59 +02:00
|
|
|
run: |
|
2024-02-08 20:05:26 +01:00
|
|
|
zip -r -q ${{ env.app_ci_output_filename }}.app.zip $ARCHIVE_PATH
|
|
|
|
mv ${{ env.app_ci_output_filename }}.app.zip $EXPORT_PATH
|
2023-09-06 19:25:59 +02:00
|
|
|
|
2022-03-17 16:24:42 +01:00
|
|
|
- name: Copy all dSYMs files to upload
|
2024-02-28 13:48:16 +01:00
|
|
|
env:
|
|
|
|
EXPORT_PATH: ./bitwarden-export
|
|
|
|
WATCH_ARCHIVE_DSYMS_PATH: ./src/watchOS/bitwarden.xcarchive/dSYMs/
|
|
|
|
WATCH_DSYMS_EXPORT_PATH: ./bitwarden-export/Watch_dSYMs
|
2022-02-14 20:06:35 +01:00
|
|
|
run: |
|
|
|
|
ARCHIVE_DSYMS_PATH="$HOME/Library/Developer/Xcode/Archives/*/*.xcarchive/dSYMs"
|
2022-12-30 18:51:35 +01:00
|
|
|
cp -r -v $ARCHIVE_DSYMS_PATH $EXPORT_PATH
|
|
|
|
mkdir $WATCH_DSYMS_EXPORT_PATH
|
|
|
|
cp -r -v $WATCH_ARCHIVE_DSYMS_PATH $WATCH_DSYMS_EXPORT_PATH
|
2022-02-14 20:06:35 +01:00
|
|
|
|
|
|
|
- name: Upload App Store .ipa & dSYMs artifacts
|
2024-07-16 21:06:47 +02:00
|
|
|
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
|
2020-06-10 16:53:57 +02:00
|
|
|
with:
|
2022-02-14 20:06:35 +01:00
|
|
|
name: Bitwarden iOS
|
|
|
|
path: |
|
|
|
|
./bitwarden-export/Bitwarden.ipa
|
|
|
|
./bitwarden-export/dSYMs/*.*
|
2021-09-24 19:50:54 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
2023-09-06 19:25:59 +02:00
|
|
|
- name: Upload .app file for Automation CI
|
2024-07-16 21:06:47 +02:00
|
|
|
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
|
2023-09-06 19:25:59 +02:00
|
|
|
with:
|
2024-02-08 20:05:26 +01:00
|
|
|
name: ${{ env.app_ci_output_filename }}.app.zip
|
|
|
|
path: ./bitwarden-export/${{ env.app_ci_output_filename }}.app.zip
|
2023-09-06 19:25:59 +02:00
|
|
|
if-no-files-found: error
|
|
|
|
|
2022-02-14 20:06:35 +01:00
|
|
|
- name: Install AppCenter CLI
|
|
|
|
if: |
|
2023-12-12 20:12:27 +01:00
|
|
|
(github.ref == 'refs/heads/main'
|
2022-03-17 16:24:42 +01:00
|
|
|
&& needs.setup.outputs.rc_branch_exists == 0
|
|
|
|
&& needs.setup.outputs.hotfix_branch_exists == 0)
|
|
|
|
|| (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0)
|
|
|
|
|| github.ref == 'refs/heads/hotfix-rc'
|
|
|
|
run: npm install -g appcenter-cli
|
2022-02-14 20:06:35 +01:00
|
|
|
|
|
|
|
- name: Upload dSYMs to App Center
|
|
|
|
if: |
|
2023-12-12 20:12:27 +01:00
|
|
|
(github.ref == 'refs/heads/main'
|
2023-01-10 19:48:22 +01:00
|
|
|
&& needs.setup.outputs.rc_branch_exists == 0
|
|
|
|
&& needs.setup.outputs.hotfix_branch_exists == 0)
|
|
|
|
|| (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0)
|
|
|
|
|| github.ref == 'refs/heads/hotfix-rc'
|
2022-02-14 20:06:35 +01:00
|
|
|
env:
|
|
|
|
APPCENTER_IOS_TOKEN: ${{ steps.retrieve-secrets.outputs.appcenter-ios-token }}
|
2022-04-22 15:35:19 +02:00
|
|
|
run: appcenter crashes upload-symbols -a bitwarden/bitwarden -s "./bitwarden-export/dSYMs" --token $APPCENTER_IOS_TOKEN
|
2022-12-30 18:51:35 +01:00
|
|
|
|
|
|
|
- name: Upload Watch dSYMs to Firebase Crashlytics
|
|
|
|
if: |
|
2023-12-12 20:12:27 +01:00
|
|
|
(github.ref == 'refs/heads/main'
|
2023-01-10 19:48:22 +01:00
|
|
|
&& needs.setup.outputs.rc_branch_exists == 0
|
|
|
|
&& needs.setup.outputs.hotfix_branch_exists == 0)
|
|
|
|
|| (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0)
|
|
|
|
|| github.ref == 'refs/heads/hotfix-rc'
|
2022-12-30 18:51:35 +01:00
|
|
|
run: |
|
|
|
|
echo "##### Uploading Watch dSYMs to Firebase"
|
|
|
|
find "$HOME/Library/Developer/XCode/DerivedData" -name "upload-symbols" -exec chmod +x {} \; -exec {} -gsp "./src/watchOS/bitwarden/GoogleService-Info.plist" -p ios "./bitwarden-export/Watch_dSYMs" \;
|
2022-02-14 20:06:35 +01:00
|
|
|
|
2024-10-14 17:20:23 +02:00
|
|
|
- name: Set up private auth key
|
|
|
|
run: |
|
|
|
|
mkdir ~/private_keys
|
|
|
|
cat << EOF > ~/private_keys/AuthKey_U362LJ87AA.p8
|
|
|
|
${{ secrets.APP_STORE_CONNECT_AUTH_KEY }}
|
|
|
|
EOF
|
|
|
|
|
2024-02-08 20:05:26 +01:00
|
|
|
- name: Validate app in App Store
|
|
|
|
run: |
|
2024-10-14 17:20:23 +02:00
|
|
|
xcrun altool \
|
|
|
|
--validate-app \
|
|
|
|
--type ios \
|
|
|
|
--file "./bitwarden-export/Bitwarden.ipa" \
|
|
|
|
--apiKey "U362LJ87AA" \
|
|
|
|
--apiIssuer ${{ secrets.APP_STORE_CONNECT_TEAM_ISSUER }}
|
2024-02-08 20:05:26 +01:00
|
|
|
|
2020-06-10 17:32:16 +02:00
|
|
|
- name: Deploy to App Store
|
2021-09-24 19:50:54 +02:00
|
|
|
if: |
|
2023-12-12 20:12:27 +01:00
|
|
|
(github.ref == 'refs/heads/main'
|
2023-01-10 19:48:22 +01:00
|
|
|
&& needs.setup.outputs.rc_branch_exists == 0
|
|
|
|
&& needs.setup.outputs.hotfix_branch_exists == 0)
|
|
|
|
|| (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0)
|
|
|
|
|| github.ref == 'refs/heads/hotfix-rc'
|
2020-07-06 15:55:16 +02:00
|
|
|
run: |
|
2024-10-14 17:20:23 +02:00
|
|
|
xcrun altool \
|
|
|
|
--upload-app \
|
|
|
|
--type ios \
|
|
|
|
--file "./bitwarden-export/Bitwarden.ipa" \
|
|
|
|
--apiKey "U362LJ87AA" \
|
|
|
|
--apiIssuer ${{ secrets.APP_STORE_CONNECT_TEAM_ISSUER }}
|
2021-10-14 20:34:24 +02:00
|
|
|
|
2021-11-05 18:59:15 +01:00
|
|
|
crowdin-push:
|
|
|
|
name: Crowdin Push
|
2023-12-12 20:12:27 +01:00
|
|
|
if: github.ref == 'refs/heads/main'
|
2021-11-05 18:59:15 +01:00
|
|
|
needs:
|
|
|
|
- android
|
|
|
|
- f-droid
|
|
|
|
- ios
|
2023-11-27 23:18:28 +01:00
|
|
|
runs-on: ubuntu-22.04
|
2021-11-05 18:59:15 +01:00
|
|
|
env:
|
|
|
|
_CROWDIN_PROJECT_ID: "269690"
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2024-07-16 21:06:47 +02:00
|
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
2021-11-05 18:59:15 +01:00
|
|
|
|
2023-04-18 12:48:05 +02:00
|
|
|
- name: Login to Azure - CI Subscription
|
2024-01-24 16:07:10 +01:00
|
|
|
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
2021-11-05 18:59:15 +01:00
|
|
|
with:
|
2023-04-11 17:18:59 +02:00
|
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
2021-11-05 18:59:15 +01:00
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2023-11-27 23:18:28 +01:00
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-ci"
|
|
|
|
secrets: "crowdin-api-token"
|
2021-11-05 18:59:15 +01:00
|
|
|
|
|
|
|
- name: Upload Sources
|
2024-06-03 22:51:08 +02:00
|
|
|
uses: crowdin/github-action@61ac8b980551f674046220c3e104bddae2916ac5 # v2.0.0
|
2021-11-05 18:59:15 +01:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
|
|
|
|
with:
|
|
|
|
config: crowdin.yml
|
2024-03-04 16:11:54 +01:00
|
|
|
crowdin_branch_name: main
|
2021-11-05 18:59:15 +01:00
|
|
|
upload_sources: true
|
|
|
|
upload_translations: false
|
|
|
|
|
|
|
|
|
2021-10-14 20:34:24 +02:00
|
|
|
check-failures:
|
|
|
|
name: Check for failures
|
|
|
|
if: always()
|
2023-11-27 23:18:28 +01:00
|
|
|
runs-on: ubuntu-22.04
|
2021-10-14 20:34:24 +02:00
|
|
|
needs:
|
|
|
|
- cloc
|
|
|
|
- android
|
|
|
|
- f-droid
|
|
|
|
- ios
|
2021-11-05 18:59:15 +01:00
|
|
|
- crowdin-push
|
2021-10-14 20:34:24 +02:00
|
|
|
steps:
|
|
|
|
- name: Check if any job failed
|
2021-11-08 15:48:40 +01:00
|
|
|
if: |
|
2024-03-06 13:58:41 +01:00
|
|
|
(github.ref == 'refs/heads/main'
|
|
|
|
|| github.ref == 'refs/heads/rc'
|
|
|
|
|| github.ref == 'refs/heads/hotfix-rc')
|
|
|
|
&& contains(needs.*.result, 'failure')
|
|
|
|
run: exit 1
|
2021-10-14 20:34:24 +02:00
|
|
|
|
2023-04-18 12:48:05 +02:00
|
|
|
- name: Login to Azure - CI Subscription
|
2024-01-24 16:07:10 +01:00
|
|
|
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
2021-10-14 20:34:24 +02:00
|
|
|
if: failure()
|
|
|
|
with:
|
2023-04-11 17:18:59 +02:00
|
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
2021-10-14 20:34:24 +02:00
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2023-11-27 23:18:28 +01:00
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
2021-10-14 20:34:24 +02:00
|
|
|
if: failure()
|
2023-11-27 23:18:28 +01:00
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-ci"
|
|
|
|
secrets: "devops-alerts-slack-webhook-url"
|
2021-10-14 20:34:24 +02:00
|
|
|
|
|
|
|
- name: Notify Slack on failure
|
2024-04-15 22:34:05 +02:00
|
|
|
uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0
|
2021-10-14 20:34:24 +02:00
|
|
|
if: failure()
|
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ steps.retrieve-secrets.outputs.devops-alerts-slack-webhook-url }}
|
|
|
|
with:
|
|
|
|
status: ${{ job.status }}
|