2021-09-02 23:04:41 +03:00
|
|
|
---
|
2020-06-05 20:51:57 +03:00
|
|
|
name: Build
|
|
|
|
|
2020-06-08 19:14:10 +03:00
|
|
|
on:
|
|
|
|
push:
|
2020-06-08 19:17:53 +03:00
|
|
|
branches-ignore:
|
2023-01-10 21:48:22 +03:00
|
|
|
- "l10n_master"
|
|
|
|
- "gh-pages"
|
2022-02-23 18:34:26 +03:00
|
|
|
paths-ignore:
|
2023-01-10 21:48:22 +03:00
|
|
|
- ".github/workflows/**"
|
2022-02-28 21:30:27 +03:00
|
|
|
workflow_dispatch:
|
2020-06-05 20:51:57 +03:00
|
|
|
|
|
|
|
jobs:
|
2020-06-09 20:18:22 +03:00
|
|
|
cloc:
|
2021-09-02 23:04:41 +03:00
|
|
|
name: CLOC
|
2023-11-28 01:18:28 +03:00
|
|
|
runs-on: ubuntu-22.04
|
2020-06-09 20:18:22 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
2020-06-09 20:18:22 +03:00
|
|
|
|
2021-09-24 20:50:54 +03:00
|
|
|
- name: Set up CLOC
|
2020-06-09 20:18:22 +03: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
|
|
|
|
|
2021-10-14 21:34:24 +03:00
|
|
|
|
2021-10-22 23:16:57 +03:00
|
|
|
setup:
|
|
|
|
name: Setup
|
2023-11-28 01:18:28 +03:00
|
|
|
runs-on: ubuntu-22.04
|
2021-10-22 23:16:57 +03:00
|
|
|
outputs:
|
|
|
|
rc_branch_exists: ${{ steps.branch-check.outputs.rc_branch_exists }}
|
2021-11-08 17:48:40 +03:00
|
|
|
hotfix_branch_exists: ${{ steps.branch-check.outputs.hotfix_branch_exists }}
|
2021-10-22 23:16:57 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
2023-03-09 21:45:51 +03:00
|
|
|
with:
|
|
|
|
submodules: 'true'
|
2021-10-22 23:16:57 +03:00
|
|
|
|
|
|
|
- name: Check if special branches exist
|
|
|
|
id: branch-check
|
|
|
|
run: |
|
|
|
|
if [[ $(git ls-remote --heads origin rc) ]]; then
|
2022-12-05 18:04:34 +03:00
|
|
|
echo "rc_branch_exists=1" >> $GITHUB_OUTPUT
|
2021-10-22 23:16:57 +03:00
|
|
|
else
|
2022-12-05 18:04:34 +03:00
|
|
|
echo "rc_branch_exists=0" >> $GITHUB_OUTPUT
|
2021-10-22 23:16:57 +03:00
|
|
|
fi
|
|
|
|
|
2022-03-09 23:46:24 +03:00
|
|
|
if [[ $(git ls-remote --heads origin hotfix-rc) ]]; then
|
2022-12-05 18:04:34 +03:00
|
|
|
echo "hotfix_branch_exists=1" >> $GITHUB_OUTPUT
|
2021-10-22 23:16:57 +03:00
|
|
|
else
|
2022-12-05 18:04:34 +03:00
|
|
|
echo "hotfix_branch_exists=0" >> $GITHUB_OUTPUT
|
2021-10-22 23:16:57 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2020-06-05 20:51:57 +03:00
|
|
|
android:
|
2021-09-02 23:04:41 +03:00
|
|
|
name: Android
|
2022-08-04 19:35:17 +03:00
|
|
|
runs-on: windows-2022
|
2021-10-22 23:16:57 +03:00
|
|
|
needs: setup
|
2022-11-02 01:14:49 +03:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-01-10 21:48:22 +03:00
|
|
|
variant: ["prod", "qa"]
|
2020-06-05 20:51:57 +03:00
|
|
|
steps:
|
2022-06-17 00:48:09 +03:00
|
|
|
- name: Setup NuGet
|
2023-05-06 03:22:58 +03:00
|
|
|
uses: nuget/setup-nuget@296fd3ccf8528660c91106efefe2364482f86d6f # v1.2.0
|
2022-06-17 00:48:09 +03:00
|
|
|
with:
|
|
|
|
nuget-version: 5.9.0
|
|
|
|
|
2023-07-13 17:05:57 +03:00
|
|
|
- name: Set up .NET
|
|
|
|
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
|
|
|
|
with:
|
|
|
|
dotnet-version: '3.1.x'
|
|
|
|
|
2020-06-05 21:39:29 +03:00
|
|
|
- name: Set up MSBuild
|
2023-05-06 03:22:58 +03:00
|
|
|
uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c # v1.3.1
|
2023-01-10 21:48:22 +03:00
|
|
|
|
2023-02-14 18:10:29 +03:00
|
|
|
- name: Setup Windows builder
|
|
|
|
run: choco install checksum --no-progress
|
|
|
|
|
2023-11-28 01:18:28 +03: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"
|
|
|
|
|
2020-06-05 20:51:57 +03:00
|
|
|
- name: Print environment
|
|
|
|
run: |
|
2021-05-17 22:15:08 +03:00
|
|
|
nuget help | grep Version
|
2020-06-05 21:39:29 +03:00
|
|
|
msbuild -version
|
2020-06-09 16:58:28 +03:00
|
|
|
dotnet --info
|
2021-05-17 22:15:08 +03:00
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
2020-06-05 20:51:57 +03:00
|
|
|
|
|
|
|
- name: Checkout repo
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
2022-11-02 01:14:49 +03:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-11-28 01:18:28 +03:00
|
|
|
|
2020-06-08 19:14:10 +03:00
|
|
|
- name: Decrypt secrets
|
|
|
|
env:
|
|
|
|
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
2021-09-24 20:50:54 +03:00
|
|
|
run: |
|
|
|
|
mkdir -p ~/secrets
|
|
|
|
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output ./src/Android/app_play-keystore.jks ./.github/secrets/app_play-keystore.jks.gpg
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output ./src/Android/app_upload-keystore.jks ./.github/secrets/app_upload-keystore.jks.gpg
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output $HOME/secrets/play_creds.json ./.github/secrets/play_creds.json.gpg
|
|
|
|
shell: bash
|
2023-11-28 01:18:28 +03:00
|
|
|
|
2022-11-02 01:14:49 +03:00
|
|
|
- name: Decrypt secrets - Google Services
|
|
|
|
if: ${{ matrix.variant == 'prod' }}
|
|
|
|
env:
|
|
|
|
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
|
|
|
run: |
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output ./src/Android/google-services.json ./.github/secrets/google-services.json.gpg
|
|
|
|
shell: bash
|
2023-11-28 01:18:28 +03:00
|
|
|
|
2020-06-08 19:14:10 +03:00
|
|
|
- name: Increment version
|
2021-09-24 20:50:54 +03:00
|
|
|
run: |
|
|
|
|
BUILD_NUMBER=$((3000 + $GITHUB_RUN_NUMBER))
|
|
|
|
|
|
|
|
echo "########################################"
|
|
|
|
echo "##### Setting Version Code $BUILD_NUMBER"
|
|
|
|
echo "########################################"
|
|
|
|
|
2021-09-25 00:02:34 +03:00
|
|
|
sed -i "s/android:versionCode=\"1\"/android:versionCode=\"$BUILD_NUMBER\"/" \
|
2021-09-24 20:50:54 +03:00
|
|
|
./src/Android/Properties/AndroidManifest.xml
|
|
|
|
shell: bash
|
2020-06-08 19:14:10 +03:00
|
|
|
|
2020-06-05 22:23:15 +03:00
|
|
|
- name: Restore packages
|
|
|
|
run: nuget restore
|
|
|
|
|
2022-04-26 18:21:07 +03:00
|
|
|
- name: Restore tools
|
|
|
|
run: dotnet tool restore
|
|
|
|
|
2022-04-26 18:27:13 +03:00
|
|
|
- name: Verify Format
|
|
|
|
run: dotnet tool run dotnet-format --check
|
2022-04-26 18:21:07 +03:00
|
|
|
|
2021-09-24 20:50:54 +03:00
|
|
|
- name: Run Core tests
|
2023-01-27 19:27:25 +03:00
|
|
|
run: dotnet test test/Core.Test/Core.Test.csproj --logger "trx;LogFileName=test-results.trx"
|
2023-01-10 21:48:22 +03:00
|
|
|
|
|
|
|
- name: Report test results
|
2023-05-06 03:22:58 +03:00
|
|
|
uses: dorny/test-reporter@c9b3d0e2bd2a4e96aaf424dbaa31c46b42318226 # v1.6.0
|
2023-01-10 21:48:22 +03:00
|
|
|
if: always()
|
|
|
|
with:
|
|
|
|
name: Test Results
|
|
|
|
path: "**/test-results.trx"
|
|
|
|
reporter: dotnet-trx
|
|
|
|
fail-on-error: true
|
2021-01-25 23:27:38 +03:00
|
|
|
|
2020-06-09 17:47:20 +03:00
|
|
|
- name: Build Play Store publisher
|
2022-11-02 01:14:49 +03:00
|
|
|
if: ${{ matrix.variant == 'prod' }}
|
2020-06-09 17:47:20 +03:00
|
|
|
run: dotnet build ./store/google/Publisher/Publisher.csproj -p:Configuration=Release
|
|
|
|
|
2022-11-02 01:14:49 +03:00
|
|
|
- name: Setup Android build (${{ matrix.variant }})
|
|
|
|
run: dotnet cake build.cake --target Android --variant ${{ matrix.variant }}
|
|
|
|
|
|
|
|
- name: Build Android
|
2021-09-24 20:50:54 +03:00
|
|
|
run: |
|
|
|
|
$configuration = "Release";
|
|
|
|
|
|
|
|
Write-Output "########################################"
|
|
|
|
Write-Output "##### Build $configuration Configuration"
|
|
|
|
Write-Output "########################################"
|
|
|
|
msbuild "$($env:GITHUB_WORKSPACE + "/src/Android/Android.csproj")" "/p:Configuration=$configuration"
|
2022-11-02 01:14:49 +03:00
|
|
|
|
|
|
|
- name: Sign Android Build
|
2020-06-08 19:14:10 +03:00
|
|
|
env:
|
|
|
|
PLAY_KEYSTORE_PASSWORD: ${{ secrets.PLAY_KEYSTORE_PASSWORD }}
|
|
|
|
UPLOAD_KEYSTORE_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_PASSWORD }}
|
2021-09-24 20:50:54 +03:00
|
|
|
run: |
|
|
|
|
$androidPath = $($env:GITHUB_WORKSPACE + "/src/Android/Android.csproj");
|
2022-11-02 01:14:49 +03:00
|
|
|
$packageName = "com.x8bit.bitwarden";
|
2023-01-10 21:48:22 +03:00
|
|
|
|
2023-04-11 18:18:59 +03:00
|
|
|
if ("${{ matrix.variant }}" -ne "prod")
|
2022-11-02 01:14:49 +03:00
|
|
|
{
|
|
|
|
$packageName = "com.x8bit.bitwarden.${{ matrix.variant }}";
|
|
|
|
}
|
2021-09-24 20:50:54 +03:00
|
|
|
Write-Output "########################################"
|
|
|
|
Write-Output "##### Sign Google Play Bundle Release Configuration"
|
|
|
|
Write-Output "########################################"
|
|
|
|
|
|
|
|
msbuild "$($androidPath)" "/t:SignAndroidPackage" "/p:Configuration=Release" "/p:AndroidKeyStore=true" `
|
|
|
|
"/p:AndroidSigningKeyAlias=upload" "/p:AndroidSigningKeyPass=$($env:UPLOAD_KEYSTORE_PASSWORD)" `
|
|
|
|
"/p:AndroidSigningKeyStore=$("app_upload-keystore.jks")" `
|
|
|
|
"/p:AndroidSigningStorePass=$($env:UPLOAD_KEYSTORE_PASSWORD)" "/p:AndroidPackageFormat=aab" "/v:quiet"
|
|
|
|
|
|
|
|
Write-Output "########################################"
|
|
|
|
Write-Output "##### Copy Google Play Bundle to project root"
|
|
|
|
Write-Output "########################################"
|
|
|
|
|
2022-11-02 01:14:49 +03:00
|
|
|
$signedAabPath = $($env:GITHUB_WORKSPACE + "/src/Android/bin/Release/$($packageName)-Signed.aab");
|
|
|
|
$signedAabDestPath = $($env:GITHUB_WORKSPACE + "/$($packageName).aab");
|
2021-09-24 20:50:54 +03:00
|
|
|
Copy-Item $signedAabPath $signedAabDestPath
|
|
|
|
|
|
|
|
Write-Output "########################################"
|
|
|
|
Write-Output "##### Sign APK Release Configuration"
|
|
|
|
Write-Output "########################################"
|
|
|
|
|
|
|
|
msbuild "$($androidPath)" "/t:SignAndroidPackage" "/p:Configuration=Release" "/p:AndroidKeyStore=true" `
|
|
|
|
"/p:AndroidSigningKeyAlias=bitwarden" "/p:AndroidSigningKeyPass=$($env:PLAY_KEYSTORE_PASSWORD)" `
|
|
|
|
"/p:AndroidSigningKeyStore=$("app_play-keystore.jks")" `
|
|
|
|
"/p:AndroidSigningStorePass=$($env:PLAY_KEYSTORE_PASSWORD)" "/v:quiet"
|
|
|
|
|
|
|
|
Write-Output "########################################"
|
|
|
|
Write-Output "##### Copy Release APK to project root"
|
|
|
|
Write-Output "########################################"
|
|
|
|
|
2022-11-02 01:14:49 +03:00
|
|
|
$signedApkPath = $($env:GITHUB_WORKSPACE + "/src/Android/bin/Release/$($packageName)-Signed.apk");
|
|
|
|
$signedApkDestPath = $($env:GITHUB_WORKSPACE + "/$($packageName).apk");
|
2021-09-24 20:50:54 +03:00
|
|
|
|
|
|
|
Copy-Item $signedApkPath $signedApkDestPath
|
2023-11-28 01:18:28 +03:00
|
|
|
|
2022-11-02 01:14:49 +03:00
|
|
|
- name: Upload Prod .aab artifact
|
|
|
|
if: ${{ matrix.variant == 'prod' }}
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
2020-06-08 19:14:10 +03:00
|
|
|
with:
|
|
|
|
name: com.x8bit.bitwarden.aab
|
|
|
|
path: ./com.x8bit.bitwarden.aab
|
2021-09-24 20:50:54 +03:00
|
|
|
if-no-files-found: error
|
2020-06-05 20:51:57 +03:00
|
|
|
|
2022-11-02 01:14:49 +03:00
|
|
|
- name: Upload Prod .apk artifact
|
|
|
|
if: ${{ matrix.variant == 'prod' }}
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
2020-06-08 19:14:10 +03:00
|
|
|
with:
|
|
|
|
name: com.x8bit.bitwarden.apk
|
|
|
|
path: ./com.x8bit.bitwarden.apk
|
2021-09-24 20:50:54 +03:00
|
|
|
if-no-files-found: error
|
2020-06-08 19:14:10 +03:00
|
|
|
|
2022-11-02 01:14:49 +03:00
|
|
|
- name: Upload Other .apk artifact
|
|
|
|
if: ${{ matrix.variant != 'prod' }}
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
2022-11-02 01:14:49 +03:00
|
|
|
with:
|
|
|
|
name: com.x8bit.bitwarden.${{ matrix.variant }}.apk
|
|
|
|
path: ./com.x8bit.bitwarden.${{ matrix.variant }}.apk
|
|
|
|
if-no-files-found: error
|
|
|
|
|
2023-02-14 18:10:29 +03: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' }}
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
2023-02-14 18:10:29 +03: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' }}
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
2023-02-14 18:10:29 +03: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 17:21:46 +03:00
|
|
|
- name: Deploy to Play Store
|
2023-12-12 22:12:27 +03:00
|
|
|
if: ${{ matrix.variant == 'prod' && (( github.ref == 'refs/heads/main'
|
2022-11-02 01:14:49 +03: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 16:50:26 +03:00
|
|
|
run: |
|
2022-02-28 22:04:09 +03:00
|
|
|
PUBLISHER_PATH="$GITHUB_WORKSPACE/store/google/Publisher/bin/Release/netcoreapp3.1/Publisher.dll"
|
2021-09-24 20:50:54 +03:00
|
|
|
CREDS_PATH="$HOME/secrets/play_creds.json"
|
2021-09-25 00:02:34 +03:00
|
|
|
AAB_PATH="$GITHUB_WORKSPACE/com.x8bit.bitwarden.aab"
|
2021-09-24 20:50:54 +03:00
|
|
|
TRACK="internal"
|
|
|
|
|
|
|
|
dotnet $PUBLISHER_PATH $CREDS_PATH $AAB_PATH $TRACK
|
|
|
|
shell: bash
|
2021-09-02 23:04:41 +03:00
|
|
|
|
2020-07-06 16:50:26 +03:00
|
|
|
|
2021-09-24 20:50:54 +03:00
|
|
|
f-droid:
|
|
|
|
name: F-Droid Build
|
2022-08-04 19:35:17 +03:00
|
|
|
runs-on: windows-2022
|
2020-07-06 16:50:26 +03:00
|
|
|
steps:
|
2022-06-17 00:48:09 +03:00
|
|
|
- name: Setup NuGet
|
2023-05-06 03:22:58 +03:00
|
|
|
uses: nuget/setup-nuget@296fd3ccf8528660c91106efefe2364482f86d6f # v1.2.0
|
2022-06-17 00:48:09 +03:00
|
|
|
with:
|
|
|
|
nuget-version: 5.9.0
|
|
|
|
|
2021-09-24 20:50:54 +03:00
|
|
|
- name: Set up MSBuild
|
2023-05-06 03:22:58 +03:00
|
|
|
uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c # v1.3.1
|
2020-07-06 16:50:26 +03:00
|
|
|
|
2023-02-14 18:10:29 +03:00
|
|
|
- name: Setup Windows builder
|
|
|
|
run: choco install checksum --no-progress
|
|
|
|
|
2023-11-28 01:18:28 +03: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 19:46:54 +03:00
|
|
|
|
2021-09-24 20:50:54 +03:00
|
|
|
- name: Print environment
|
2020-07-06 16:50:26 +03:00
|
|
|
run: |
|
2021-09-24 20:50:54 +03:00
|
|
|
nuget help | grep Version
|
|
|
|
msbuild -version
|
|
|
|
dotnet --info
|
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
2020-07-06 16:50:26 +03:00
|
|
|
|
2021-09-24 20:50:54 +03:00
|
|
|
- name: Checkout repo
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
2021-09-24 20:50:54 +03:00
|
|
|
|
|
|
|
- name: Decrypt secrets
|
2020-07-06 16:50:26 +03:00
|
|
|
env:
|
2021-09-24 20:50:54 +03:00
|
|
|
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
2020-07-06 16:50:26 +03:00
|
|
|
run: |
|
2021-09-24 20:50:54 +03:00
|
|
|
mkdir -p ~/secrets
|
2020-07-06 16:50:26 +03:00
|
|
|
|
2021-09-24 20:50:54 +03:00
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output ./src/Android/app_fdroid-keystore.jks ./.github/secrets/app_fdroid-keystore.jks.gpg
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Increment version
|
2020-07-06 16:50:26 +03:00
|
|
|
run: |
|
2021-09-24 20:50:54 +03:00
|
|
|
BUILD_NUMBER=$((3000 + $GITHUB_RUN_NUMBER))
|
2020-07-06 16:50:26 +03:00
|
|
|
|
2021-09-24 20:50:54 +03:00
|
|
|
echo "########################################"
|
|
|
|
echo "##### Setting Version Code $BUILD_NUMBER"
|
|
|
|
echo "########################################"
|
2020-07-06 16:50:26 +03:00
|
|
|
|
2021-10-28 16:49:29 +03:00
|
|
|
sed -i "s/android:versionCode=\"1\"/android:versionCode=\"$BUILD_NUMBER\"/" \
|
2021-09-24 20:50:54 +03:00
|
|
|
./src/Android/Properties/AndroidManifest.xml
|
|
|
|
shell: bash
|
2020-07-06 16:50:26 +03:00
|
|
|
|
2021-09-24 20:50:54 +03:00
|
|
|
- name: Clean for F-Droid
|
2020-07-06 16:50:26 +03:00
|
|
|
run: |
|
2021-09-24 20:50:54 +03:00
|
|
|
$androidPath = $($env:GITHUB_WORKSPACE + "/src/Android/Android.csproj");
|
|
|
|
$appPath = $($env:GITHUB_WORKSPACE + "/src/App/App.csproj");
|
2022-03-08 20:45:55 +03:00
|
|
|
$corePath = $($env:GITHUB_WORKSPACE + "/src/Core/Core.csproj");
|
2021-09-24 20:50:54 +03:00
|
|
|
|
|
|
|
$androidManifest = $($env:GITHUB_WORKSPACE + "/src/Android/Properties/AndroidManifest.xml");
|
|
|
|
|
|
|
|
Write-Output "########################################"
|
|
|
|
Write-Output "##### Clean Android and App"
|
|
|
|
Write-Output "########################################"
|
|
|
|
|
|
|
|
msbuild "$($androidPath)" "/t:Clean" "/p:Configuration=FDroid"
|
|
|
|
msbuild "$($appPath)" "/t:Clean" "/p:Configuration=FDroid"
|
|
|
|
|
|
|
|
Write-Output "########################################"
|
|
|
|
Write-Output "##### Backup project files"
|
|
|
|
Write-Output "########################################"
|
|
|
|
|
|
|
|
Copy-Item $androidManifest $($androidManifest + ".original");
|
|
|
|
Copy-Item $androidPath $($androidPath + ".original");
|
|
|
|
Copy-Item $appPath $($appPath + ".original");
|
|
|
|
|
|
|
|
Write-Output "########################################"
|
|
|
|
Write-Output "##### Cleanup Android Manifest"
|
|
|
|
Write-Output "########################################"
|
|
|
|
|
|
|
|
$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);
|
|
|
|
|
|
|
|
Write-Output "########################################"
|
|
|
|
Write-Output "##### Uninstall from Android.csproj"
|
|
|
|
Write-Output "########################################"
|
|
|
|
|
|
|
|
$xml=New-Object XML;
|
|
|
|
$xml.Load($androidPath);
|
|
|
|
|
|
|
|
$ns=New-Object System.Xml.XmlNamespaceManager($xml.NameTable);
|
|
|
|
$ns.AddNamespace("ns", $xml.DocumentElement.NamespaceURI);
|
|
|
|
|
|
|
|
$firebaseNode=$xml.SelectSingleNode(`
|
|
|
|
"/ns:Project/ns:ItemGroup/ns:PackageReference[@Include='Xamarin.Firebase.Messaging']", $ns);
|
|
|
|
$firebaseNode.ParentNode.RemoveChild($firebaseNode);
|
|
|
|
|
|
|
|
$daggerNode=$xml.SelectSingleNode(`
|
|
|
|
"/ns:Project/ns:ItemGroup/ns:PackageReference[@Include='Xamarin.Google.Dagger']", $ns);
|
|
|
|
$daggerNode.ParentNode.RemoveChild($daggerNode);
|
|
|
|
|
|
|
|
$safetyNetNode=$xml.SelectSingleNode(`
|
|
|
|
"/ns:Project/ns:ItemGroup/ns:PackageReference[@Include='Xamarin.GooglePlayServices.SafetyNet']", $ns);
|
|
|
|
$safetyNetNode.ParentNode.RemoveChild($safetyNetNode);
|
|
|
|
|
|
|
|
$xml.Save($androidPath);
|
|
|
|
|
2022-03-08 20:45:55 +03:00
|
|
|
Write-Output "########################################"
|
|
|
|
Write-Output "##### Uninstall from Core.csproj"
|
|
|
|
Write-Output "########################################"
|
|
|
|
|
|
|
|
$xml=New-Object XML;
|
|
|
|
$xml.Load($corePath);
|
|
|
|
|
|
|
|
$appCenterNode=$xml.SelectSingleNode("/Project/ItemGroup/PackageReference[@Include='Microsoft.AppCenter.Crashes']");
|
|
|
|
$appCenterNode.ParentNode.RemoveChild($appCenterNode);
|
|
|
|
|
|
|
|
$xml.Save($corePath);
|
2020-07-06 16:50:26 +03:00
|
|
|
|
2021-09-24 20:50:54 +03:00
|
|
|
- name: Restore packages
|
|
|
|
run: nuget restore
|
|
|
|
|
|
|
|
- name: Build for F-Droid
|
2020-07-06 20:28:19 +03:00
|
|
|
run: |
|
2021-09-24 20:50:54 +03:00
|
|
|
$configuration = "FDroid";
|
|
|
|
|
|
|
|
Write-Output "########################################"
|
|
|
|
Write-Output "##### Build $configuration Configuration"
|
|
|
|
Write-Output "########################################"
|
|
|
|
|
|
|
|
msbuild "$($env:GITHUB_WORKSPACE + "/src/Android/Android.csproj")" "/p:Configuration=$configuration"
|
|
|
|
|
|
|
|
- name: Sign for F-Droid
|
2020-07-06 16:50:26 +03:00
|
|
|
env:
|
2021-09-24 20:50:54 +03:00
|
|
|
FDROID_KEYSTORE_PASSWORD: ${{ secrets.FDROID_KEYSTORE_PASSWORD }}
|
|
|
|
run: |
|
|
|
|
Write-Output "########################################"
|
|
|
|
Write-Output "##### Sign FDroid Configuration"
|
|
|
|
Write-Output "########################################"
|
|
|
|
|
|
|
|
msbuild "$($env:GITHUB_WORKSPACE + "/src/Android/Android.csproj")" `
|
|
|
|
"/t:SignAndroidPackage" "/p:Configuration=FDroid" "/p:AndroidKeyStore=true" `
|
|
|
|
"/p:AndroidSigningKeyAlias=bitwarden" "/p:AndroidSigningKeyPass=$($env:FDROID_KEYSTORE_PASSWORD)" `
|
|
|
|
"/p:AndroidSigningKeyStore=$("app_fdroid-keystore.jks")" `
|
|
|
|
"/p:AndroidSigningStorePass=$($env:FDROID_KEYSTORE_PASSWORD)" "/v:quiet"
|
|
|
|
|
|
|
|
Write-Output "########################################"
|
|
|
|
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");
|
|
|
|
|
|
|
|
Copy-Item $signedApkPath $signedApkDestPath
|
|
|
|
|
|
|
|
- name: Upload F-Droid .apk artifact
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
2021-09-24 20:50:54 +03:00
|
|
|
with:
|
|
|
|
name: com.x8bit.bitwarden-fdroid.apk
|
|
|
|
path: ./com.x8bit.bitwarden-fdroid.apk
|
|
|
|
if-no-files-found: error
|
2020-07-06 16:50:26 +03:00
|
|
|
|
2023-02-14 18:10:29 +03: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
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
2023-02-14 18:10:29 +03:00
|
|
|
with:
|
|
|
|
name: bw-fdroid-apk-sha256.txt
|
|
|
|
path: ./bw-fdroid-apk-sha256.txt
|
|
|
|
if-no-files-found: error
|
|
|
|
|
2020-07-06 16:50:26 +03:00
|
|
|
|
2020-06-08 19:14:10 +03:00
|
|
|
ios:
|
2021-09-02 23:04:41 +03:00
|
|
|
name: Apple iOS
|
2022-12-30 20:51:35 +03:00
|
|
|
runs-on: macos-12
|
2021-10-22 23:16:57 +03:00
|
|
|
needs: setup
|
2020-06-05 20:51:57 +03:00
|
|
|
steps:
|
2022-06-17 00:48:09 +03:00
|
|
|
- name: Setup NuGet
|
2023-05-06 03:22:58 +03:00
|
|
|
uses: nuget/setup-nuget@296fd3ccf8528660c91106efefe2364482f86d6f # v1.2.0
|
2022-06-17 00:48:09 +03:00
|
|
|
with:
|
|
|
|
nuget-version: 5.9.0
|
|
|
|
|
2020-06-05 20:51:57 +03:00
|
|
|
- name: Print environment
|
|
|
|
run: |
|
2021-05-17 22:15:08 +03:00
|
|
|
nuget help | grep Version
|
2020-06-05 21:39:29 +03:00
|
|
|
msbuild -version
|
2020-06-09 16:58:28 +03:00
|
|
|
dotnet --info
|
2021-05-17 22:15:08 +03:00
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
2020-06-05 20:51:57 +03:00
|
|
|
|
|
|
|
- name: Checkout repo
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
2023-03-09 21:45:51 +03:00
|
|
|
with:
|
|
|
|
submodules: 'true'
|
2020-06-05 20:51:57 +03:00
|
|
|
|
2023-04-18 13:48:05 +03:00
|
|
|
- name: Login to Azure - CI Subscription
|
2023-09-06 17:30:47 +03:00
|
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.6
|
2022-02-14 22:06:35 +03:00
|
|
|
with:
|
2023-04-11 18:18:59 +03:00
|
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
2022-02-14 22:06:35 +03:00
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-ci"
|
|
|
|
secrets: "appcenter-ios-token"
|
2022-02-14 22:06:35 +03:00
|
|
|
|
2020-06-09 17:47:09 +03:00
|
|
|
- name: Decrypt secrets
|
|
|
|
env:
|
|
|
|
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
2021-09-24 20:50:54 +03:00
|
|
|
run: |
|
|
|
|
mkdir -p ~/secrets
|
|
|
|
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output $HOME/secrets/bitwarden-mobile-key.p12 ./.github/secrets/bitwarden-mobile-key.p12.gpg
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output $HOME/secrets/iphone-distribution-cert.p12 ./.github/secrets/iphone-distribution-cert.p12.gpg
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output $HOME/secrets/dist_autofill.mobileprovision ./.github/secrets/dist_autofill.mobileprovision.gpg
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output $HOME/secrets/dist_bitwarden.mobileprovision ./.github/secrets/dist_bitwarden.mobileprovision.gpg
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output $HOME/secrets/dist_extension.mobileprovision ./.github/secrets/dist_extension.mobileprovision.gpg
|
2022-01-25 23:41:56 +03:00
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
2022-03-17 18:24:42 +03:00
|
|
|
--output $HOME/secrets/dist_share_extension.mobileprovision \
|
|
|
|
./.github/secrets/dist_share_extension.mobileprovision.gpg
|
2022-12-07 19:39:20 +03:00
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output $HOME/secrets/dist_watch_app.mobileprovision \
|
|
|
|
./.github/secrets/dist_watch_app.mobileprovision.gpg
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output $HOME/secrets/dist_watch_app_extension.mobileprovision \
|
|
|
|
./.github/secrets/dist_watch_app_extension.mobileprovision.gpg
|
2022-12-30 20:51:35 +03:00
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output ./src/watchOS/bitwarden/GoogleService-Info.plist ./.github/secrets/GoogleService-Info.plist.gpg
|
2020-06-09 17:47:09 +03:00
|
|
|
|
2020-06-10 04:23:10 +03:00
|
|
|
- name: Increment version
|
2021-09-24 20:50:54 +03:00
|
|
|
run: |
|
|
|
|
BUILD_NUMBER=$((100 + $GITHUB_RUN_NUMBER))
|
2020-06-10 04:23:10 +03:00
|
|
|
|
2021-09-24 20:50:54 +03:00
|
|
|
echo "########################################"
|
|
|
|
echo "##### Setting CFBundleVersion $BUILD_NUMBER"
|
|
|
|
echo "########################################"
|
|
|
|
|
|
|
|
perl -0777 -pi.bak -e 's/<key>CFBundleVersion<\/key>\s*<string>1<\/string>/<key>CFBundleVersion<\/key>\n\t<string>'"$BUILD_NUMBER"'<\/string>/' ./src/iOS/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.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 23:41:56 +03: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 19:39:20 +03:00
|
|
|
cd src/watchOS/bitwarden
|
|
|
|
agvtool new-version -all $BUILD_NUMBER
|
2021-09-24 20:50:54 +03:00
|
|
|
|
2022-01-18 17:52:08 +03:00
|
|
|
- name: Update Entitlements
|
|
|
|
run: |
|
|
|
|
echo "########################################"
|
|
|
|
echo "##### Updating Entitlements"
|
|
|
|
echo "########################################"
|
|
|
|
|
|
|
|
perl -0777 -pi.bak -e 's/<key>aps-environment<\/key>\s*<string>development<\/string>/<key>aps-environment<\/key>\n\t<string>production<\/string>/' ./src/iOS/Entitlements.plist
|
|
|
|
|
2021-09-24 20:50:54 +03:00
|
|
|
- name: Set up Keychain
|
2020-06-09 18:37:40 +03:00
|
|
|
env:
|
|
|
|
KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEYCHAIN_PASSWORD }}
|
|
|
|
MOBILE_KEY_PASSWORD: ${{ secrets.IOS_KEY_PASSWORD }}
|
|
|
|
DIST_CERT_PASSWORD: ${{ secrets.IOS_DIST_CERT_PASSWORD }}
|
2021-09-24 20:50:54 +03: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
|
|
|
|
security import ~/secrets/bitwarden-mobile-key.p12 -k build.keychain -P $MOBILE_KEY_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security
|
|
|
|
security import ~/secrets/iphone-distribution-cert.p12 -k build.keychain -P $DIST_CERT_PASSWORD \
|
|
|
|
-T /usr/bin/codesign -T /usr/bin/security
|
|
|
|
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain
|
2020-06-09 18:37:40 +03:00
|
|
|
|
2020-06-09 19:25:09 +03:00
|
|
|
- name: Set up provisioning profiles
|
2021-09-24 20:50:54 +03: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 23:41:56 +03:00
|
|
|
SHARE_EXTENSION_PROFILE_PATH=$HOME/secrets/dist_share_extension.mobileprovision
|
2022-12-07 19:39:20 +03:00
|
|
|
WATCH_APP_PROFILE_PATH=$HOME/secrets/dist_watch_app.mobileprovision
|
|
|
|
WATCH_APP_EXTENSION_PROFILE_PATH=$HOME/secrets/dist_watch_app_extension.mobileprovision
|
2021-09-24 20:50:54 +03: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 23:41:56 +03: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 19:39:20 +03: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"
|
|
|
|
|
|
|
|
- name: Bulid WatchApp
|
|
|
|
run: |
|
|
|
|
echo "########################################"
|
|
|
|
echo "##### Build WatchApp with Release Configuration"
|
|
|
|
echo "########################################"
|
2023-01-10 21:48:22 +03:00
|
|
|
|
2022-12-07 19:39:20 +03:00
|
|
|
xcodebuild archive -workspace ./src/watchOS/bitwarden/bitwarden.xcodeproj/project.xcworkspace -configuration Release -scheme bitwarden\ WatchKit\ App -archivePath ./src/watchOS/bitwarden
|
|
|
|
|
|
|
|
echo "########################################"
|
|
|
|
echo "##### Done"
|
|
|
|
echo "########################################"
|
2020-06-09 19:25:09 +03:00
|
|
|
|
2020-06-05 22:23:15 +03:00
|
|
|
- name: Restore packages
|
|
|
|
run: nuget restore
|
|
|
|
|
2020-06-10 16:03:12 +03:00
|
|
|
- name: Archive Build for App Store
|
2021-09-24 20:50:54 +03:00
|
|
|
run: |
|
|
|
|
$configuration = "AppStore";
|
|
|
|
$platform = "iPhone";
|
|
|
|
|
2023-09-06 20:25:59 +03:00
|
|
|
Write-Output "########################################"
|
|
|
|
Write-Output "##### Archive $configuration Configuration for $platform Platform"
|
|
|
|
Write-Output "########################################"
|
|
|
|
msbuild "$($env:GITHUB_WORKSPACE + "/src/iOS/iOS.csproj")" "/p:Platform=$platform" `
|
|
|
|
"/p:Configuration=$configuration" "/p:ArchiveOnBuild=true" "/t:`"Build`""
|
|
|
|
|
|
|
|
Write-Output "########################################"
|
|
|
|
Write-Output "##### Done"
|
|
|
|
Write-Output "########################################"
|
|
|
|
shell: pwsh
|
|
|
|
|
|
|
|
- name: Archive Build for Mobile Automation
|
|
|
|
run: |
|
|
|
|
$configuration = "Release";
|
|
|
|
$platform = "iPhoneSimulator";
|
|
|
|
|
2021-09-24 20:50:54 +03:00
|
|
|
Write-Output "########################################"
|
|
|
|
Write-Output "##### Archive $configuration Configuration for $platform Platform"
|
|
|
|
Write-Output "########################################"
|
|
|
|
msbuild "$($env:GITHUB_WORKSPACE + "/src/iOS/iOS.csproj")" "/p:Platform=$platform" `
|
|
|
|
"/p:Configuration=$configuration" "/p:ArchiveOnBuild=true" "/t:`"Build`""
|
|
|
|
|
|
|
|
Write-Output "########################################"
|
|
|
|
Write-Output "##### Done"
|
|
|
|
Write-Output "########################################"
|
|
|
|
ls ~/Library/Developer/Xcode/Archives
|
2020-06-10 18:33:43 +03:00
|
|
|
shell: pwsh
|
2020-06-10 17:02:15 +03:00
|
|
|
|
|
|
|
- name: Export .ipa for App Store
|
2021-09-24 20:50:54 +03:00
|
|
|
run: |
|
|
|
|
EXPORT_OPTIONS_PATH="./.github/resources/export-options-app-store.plist"
|
|
|
|
ARCHIVE_PATH="$HOME/Library/Developer/Xcode/Archives/*/*.xcarchive"
|
|
|
|
EXPORT_PATH="./bitwarden-export"
|
|
|
|
|
|
|
|
xcodebuild -exportArchive -archivePath $ARCHIVE_PATH -exportPath $EXPORT_PATH \
|
|
|
|
-exportOptionsPlist $EXPORT_OPTIONS_PATH
|
2020-06-10 17:53:57 +03:00
|
|
|
|
2023-09-06 20:25:59 +03:00
|
|
|
- name: Export .app for Automation CI
|
|
|
|
run: |
|
|
|
|
ARCHIVE_PATH="./src/iOS/bin/iPhoneSimulator/Release/BitwardeniOS.app"
|
|
|
|
EXPORT_PATH="./bitwarden-export"
|
|
|
|
|
|
|
|
zip -r -q BitwardeniOS.app.zip $ARCHIVE_PATH
|
|
|
|
mv BitwardeniOS.app.zip $EXPORT_PATH
|
|
|
|
|
2022-03-17 18:24:42 +03:00
|
|
|
- name: Copy all dSYMs files to upload
|
2022-02-14 22:06:35 +03:00
|
|
|
run: |
|
|
|
|
ARCHIVE_DSYMS_PATH="$HOME/Library/Developer/Xcode/Archives/*/*.xcarchive/dSYMs"
|
|
|
|
EXPORT_PATH="./bitwarden-export"
|
|
|
|
|
2022-12-30 20:51:35 +03:00
|
|
|
WATCH_ARCHIVE_DSYMS_PATH="./src/watchOS/bitwarden.xcarchive/dSYMs/"
|
|
|
|
WATCH_DSYMS_EXPORT_PATH="$EXPORT_PATH/Watch_dSYMs"
|
|
|
|
|
|
|
|
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 22:06:35 +03:00
|
|
|
|
|
|
|
- name: Upload App Store .ipa & dSYMs artifacts
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
2020-06-10 17:53:57 +03:00
|
|
|
with:
|
2022-02-14 22:06:35 +03:00
|
|
|
name: Bitwarden iOS
|
|
|
|
path: |
|
|
|
|
./bitwarden-export/Bitwarden.ipa
|
|
|
|
./bitwarden-export/dSYMs/*.*
|
2021-09-24 20:50:54 +03:00
|
|
|
if-no-files-found: error
|
|
|
|
|
2023-09-06 20:25:59 +03:00
|
|
|
- name: Upload .app file for Automation CI
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
2023-09-06 20:25:59 +03:00
|
|
|
with:
|
|
|
|
name: BitwardeniOS.app.zip
|
|
|
|
path: ./bitwarden-export/BitwardeniOS.app.zip
|
|
|
|
if-no-files-found: error
|
|
|
|
|
2022-02-14 22:06:35 +03:00
|
|
|
- name: Install AppCenter CLI
|
|
|
|
if: |
|
2023-12-12 22:12:27 +03:00
|
|
|
(github.ref == 'refs/heads/main'
|
2022-03-17 18:24:42 +03: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 22:06:35 +03:00
|
|
|
|
|
|
|
- name: Upload dSYMs to App Center
|
|
|
|
if: |
|
2023-12-12 22:12:27 +03:00
|
|
|
(github.ref == 'refs/heads/main'
|
2023-01-10 21:48:22 +03: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 22:06:35 +03:00
|
|
|
env:
|
|
|
|
APPCENTER_IOS_TOKEN: ${{ steps.retrieve-secrets.outputs.appcenter-ios-token }}
|
2022-04-22 16:35:19 +03:00
|
|
|
run: appcenter crashes upload-symbols -a bitwarden/bitwarden -s "./bitwarden-export/dSYMs" --token $APPCENTER_IOS_TOKEN
|
2022-12-30 20:51:35 +03:00
|
|
|
|
|
|
|
- name: Upload Watch dSYMs to Firebase Crashlytics
|
|
|
|
if: |
|
2023-12-12 22:12:27 +03:00
|
|
|
(github.ref == 'refs/heads/main'
|
2023-01-10 21:48:22 +03: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 20:51:35 +03:00
|
|
|
run: |
|
|
|
|
echo "########################################"
|
|
|
|
echo "##### Uploading Watch dSYMs to Firebase"
|
|
|
|
echo "########################################"
|
|
|
|
|
|
|
|
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 22:06:35 +03:00
|
|
|
|
2020-06-10 18:32:16 +03:00
|
|
|
- name: Deploy to App Store
|
2021-09-24 20:50:54 +03:00
|
|
|
if: |
|
2023-12-12 22:12:27 +03:00
|
|
|
(github.ref == 'refs/heads/main'
|
2023-01-10 21:48:22 +03: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-06-10 18:32:16 +03:00
|
|
|
env:
|
|
|
|
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
|
|
|
|
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
2020-07-06 16:55:16 +03:00
|
|
|
run: |
|
2021-09-25 00:02:34 +03:00
|
|
|
xcrun altool --upload-app --type ios --file "./bitwarden-export/Bitwarden.ipa" \
|
2021-09-24 20:50:54 +03:00
|
|
|
--username "$APPLE_ID_USERNAME" --password "$APPLE_ID_PASSWORD"
|
2021-10-14 21:34:24 +03:00
|
|
|
|
|
|
|
|
2021-11-05 20:59:15 +03:00
|
|
|
crowdin-push:
|
|
|
|
name: Crowdin Push
|
2023-12-12 22:12:27 +03:00
|
|
|
if: github.ref == 'refs/heads/main'
|
2021-11-05 20:59:15 +03:00
|
|
|
needs:
|
|
|
|
- android
|
|
|
|
- f-droid
|
|
|
|
- ios
|
2023-11-28 01:18:28 +03:00
|
|
|
runs-on: ubuntu-22.04
|
2021-11-05 20:59:15 +03:00
|
|
|
env:
|
|
|
|
_CROWDIN_PROJECT_ID: "269690"
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
2021-11-05 20:59:15 +03:00
|
|
|
|
2023-04-18 13:48:05 +03:00
|
|
|
- name: Login to Azure - CI Subscription
|
2023-09-06 17:30:47 +03:00
|
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.6
|
2021-11-05 20:59:15 +03:00
|
|
|
with:
|
2023-04-11 18:18:59 +03:00
|
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
2021-11-05 20:59:15 +03:00
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-ci"
|
|
|
|
secrets: "crowdin-api-token"
|
2021-11-05 20:59:15 +03:00
|
|
|
|
|
|
|
- name: Upload Sources
|
2023-06-13 17:57:02 +03:00
|
|
|
uses: crowdin/github-action@965d501f160af7b1f88aed4c29154b0caf1e94b9 # v1.9.0
|
2021-11-05 20:59:15 +03:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
|
|
|
|
with:
|
|
|
|
config: crowdin.yml
|
2023-12-12 22:12:27 +03:00
|
|
|
crowdin_branch_name: main
|
2021-11-05 20:59:15 +03:00
|
|
|
upload_sources: true
|
|
|
|
upload_translations: false
|
|
|
|
|
|
|
|
|
2021-10-14 21:34:24 +03:00
|
|
|
check-failures:
|
|
|
|
name: Check for failures
|
|
|
|
if: always()
|
2023-11-28 01:18:28 +03:00
|
|
|
runs-on: ubuntu-22.04
|
2021-10-14 21:34:24 +03:00
|
|
|
needs:
|
|
|
|
- cloc
|
|
|
|
- android
|
|
|
|
- f-droid
|
|
|
|
- ios
|
2021-11-05 20:59:15 +03:00
|
|
|
- crowdin-push
|
2021-10-14 21:34:24 +03:00
|
|
|
steps:
|
|
|
|
- name: Check if any job failed
|
2021-11-08 17:48:40 +03:00
|
|
|
if: |
|
2023-12-12 22:12:27 +03:00
|
|
|
(github.ref == 'refs/heads/main')
|
2023-01-10 21:48:22 +03:00
|
|
|
|| (github.ref == 'refs/heads/rc')
|
|
|
|
|| (github.ref == 'refs/heads/hotfix-rc')
|
2021-10-14 21:34:24 +03:00
|
|
|
env:
|
|
|
|
CLOC_STATUS: ${{ needs.cloc.result }}
|
|
|
|
ANDROID_STATUS: ${{ needs.android.result }}
|
|
|
|
F_DROID_STATUS: ${{ needs.f-droid.result }}
|
|
|
|
IOS_STATUS: ${{ needs.ios.result }}
|
2021-11-05 20:59:15 +03:00
|
|
|
CROWDIN_PUSH_STATUS: ${{ needs.crowdin-push.result }}
|
2021-10-14 21:34:24 +03:00
|
|
|
run: |
|
|
|
|
if [ "$CLOC_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
|
|
|
elif [ "$ANDROID_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
|
|
|
elif [ "$F_DROID_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
|
|
|
elif [ "$IOS_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
2021-11-05 20:59:15 +03:00
|
|
|
elif [ "$CROWDIN_PUSH_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
2021-10-14 21:34:24 +03:00
|
|
|
fi
|
|
|
|
|
2023-04-18 13:48:05 +03:00
|
|
|
- name: Login to Azure - CI Subscription
|
2023-09-06 17:30:47 +03:00
|
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.6
|
2021-10-14 21:34:24 +03:00
|
|
|
if: failure()
|
|
|
|
with:
|
2023-04-11 18:18:59 +03:00
|
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
2021-10-14 21:34:24 +03:00
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2023-11-28 01:18:28 +03:00
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
2021-10-14 21:34:24 +03:00
|
|
|
if: failure()
|
2023-11-28 01:18:28 +03:00
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-ci"
|
|
|
|
secrets: "devops-alerts-slack-webhook-url"
|
2021-10-14 21:34:24 +03:00
|
|
|
|
|
|
|
- name: Notify Slack on failure
|
2023-05-06 03:22:58 +03:00
|
|
|
uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f # v2.0.0
|
2021-10-14 21:34:24 +03:00
|
|
|
if: failure()
|
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ steps.retrieve-secrets.outputs.devops-alerts-slack-webhook-url }}
|
|
|
|
with:
|
|
|
|
status: ${{ job.status }}
|