bitwarden-android/.github/workflows/build.yml

296 lines
9.7 KiB
YAML
Raw Normal View History

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:
- 'l10n_master'
- 'gh-pages'
2020-07-06 16:50:26 +03:00
release:
types:
- published
2020-06-05 20:51:57 +03:00
jobs:
2020-06-09 20:18:22 +03:00
cloc:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
2020-06-09 20:18:22 +03:00
- name: Set up cloc
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
2020-06-05 20:51:57 +03:00
android:
runs-on: windows-latest
steps:
2020-06-05 21:39:29 +03:00
- name: Set up MSBuild
uses: microsoft/setup-msbuild@c26a08ba26249b81327e26f6ef381897b6a8754d
2020-06-05 21:39:29 +03:00
2020-06-05 20:51:57 +03:00
- name: Print environment
run: |
nuget help | grep Version
2020-06-05 21:39:29 +03:00
msbuild -version
2020-06-09 16:58:28 +03:00
dotnet --info
echo "GitHub ref: $GITHUB_REF"
echo "GitHub event: $GITHUB_EVENT"
2020-06-11 23:26:10 +03:00
env:
GITHUB_REF: ${{ github.ref }}
2020-07-06 16:50:26 +03:00
GITHUB_EVENT: ${{ github.event_name }}
2020-06-05 20:51:57 +03:00
- name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
2020-06-05 20:51:57 +03:00
2020-06-08 19:14:10 +03:00
- name: Decrypt secrets
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-06-08 19:55:02 +03:00
run: ./.github/scripts/android/decrypt-secrets.ps1
2020-06-08 19:29:57 +03:00
shell: pwsh
2020-06-08 19:14:10 +03:00
env:
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
- name: Increment version
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-06-08 19:55:02 +03:00
run: ./.github/scripts/android/increment-version.ps1
2020-06-08 19:29:57 +03:00
shell: pwsh
2020-06-08 19:14:10 +03:00
- name: Restore packages
run: nuget restore
- name: Run Core Tests
run: dotnet test test/Core.Test/Core.Test.csproj
2020-06-09 17:47:20 +03:00
- name: Build Play Store publisher
run: dotnet build ./store/google/Publisher/Publisher.csproj -p:Configuration=Release
2020-06-08 23:04:04 +03:00
- name: Build for Play Store
2020-06-08 20:19:44 +03:00
run: ./.github/scripts/android/build.ps1 -configuration Release
shell: pwsh
- name: Sign for Play Store
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-06-08 20:19:44 +03:00
run: ./.github/scripts/android/sign-play.ps1
2020-06-08 19:29:57 +03:00
shell: pwsh
2020-06-08 19:14:10 +03:00
env:
PLAY_KEYSTORE_PASSWORD: ${{ secrets.PLAY_KEYSTORE_PASSWORD }}
UPLOAD_KEYSTORE_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_PASSWORD }}
2020-06-05 20:51:57 +03:00
2020-06-08 20:19:44 +03:00
- name: Upload Play Store .aab artifact
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700
2020-06-08 19:14:10 +03:00
with:
name: com.x8bit.bitwarden.aab
path: ./com.x8bit.bitwarden.aab
2020-06-05 20:51:57 +03:00
2020-06-08 20:19:44 +03:00
- name: Upload Play Store .apk artifact
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700
2020-06-08 19:14:10 +03:00
with:
name: com.x8bit.bitwarden.apk
path: ./com.x8bit.bitwarden.apk
2020-06-08 23:04:04 +03:00
- name: Clean for F-Droid
run: ./.github/scripts/android/clean-fdroid.ps1
shell: pwsh
- name: Restore packages
run: nuget restore
- name: Build for F-Droid
run: ./.github/scripts/android/build.ps1 -configuration FDroid
shell: pwsh
- name: Sign for F-Droid
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-06-08 23:04:04 +03:00
run: ./.github/scripts/android/sign-fdroid.ps1
2020-06-08 19:29:57 +03:00
shell: pwsh
2020-06-08 19:14:10 +03:00
env:
FDROID_KEYSTORE_PASSWORD: ${{ secrets.FDROID_KEYSTORE_PASSWORD }}
2020-06-08 20:19:44 +03:00
- name: Upload F-Droid .apk artifact
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700
2020-06-08 19:14:10 +03:00
with:
name: com.x8bit.bitwarden-fdroid.apk
path: ./com.x8bit.bitwarden-fdroid.apk
2020-06-09 17:21:46 +03:00
- name: Deploy to Play Store
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-06-09 17:21:46 +03:00
run: ./.github/scripts/android/deploy-play.ps1
shell: pwsh
2020-07-06 16:50:26 +03:00
- name: Upload release assets
if: github.event_name == 'release'
run: |
hub release edit `
-a ./com.x8bit.bitwarden.aab `
-a ./com.x8bit.bitwarden.apk `
-a ./com.x8bit.bitwarden-fdroid.apk `
2020-07-06 20:28:19 +03:00
-m "Version $($env:RELEASE_TAG_NAME.TrimStart('v'))" `
2020-07-06 16:50:26 +03:00
$env:RELEASE_TAG_NAME
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
android-ubuntu:
runs-on: ubuntu-latest
needs: android
2020-07-06 16:50:26 +03:00
steps:
- name: Set up Node
if: github.event_name == 'release'
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea
2020-07-06 16:50:26 +03:00
with:
node-version: '10.x'
- name: Set up F-Droid server
if: github.event_name == 'release'
2020-07-06 16:50:26 +03:00
run: |
sudo apt-get -qq update
sudo apt-get -qqy install --no-install-recommends fdroidserver wget
- name: Set up git credentials
if: github.event_name == 'release'
2020-07-06 16:50:26 +03:00
env:
2020-07-06 20:54:44 +03:00
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
2020-07-06 16:50:26 +03:00
run: |
git config --global credential.helper store
2020-07-06 20:54:44 +03:00
echo "https://${ACCESS_TOKEN}:x-oauth-basic@github.com" >> ~/.git-credentials
2020-07-06 16:50:26 +03:00
git config --global user.email "ci@bitwarden.com"
git config --global user.name "Bitwarden CI"
- name: Print environment
if: github.event_name == 'release'
2020-07-06 16:50:26 +03:00
run: |
node --version
npm --version
git --version
Write-Output "GitHub ref: $env:GITHUB_REF"
Write-Output "GitHub event: $env:GITHUB_EVENT"
shell: pwsh
env:
GITHUB_REF: ${{ github.ref }}
GITHUB_EVENT: ${{ github.event_name }}
- name: Checkout repo
if: github.event_name == 'release'
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
2020-07-06 16:50:26 +03:00
- name: Install Node dependencies
if: github.event_name == 'release'
2020-07-06 16:50:26 +03:00
run: npm install
- name: Decrypt secrets
if: github.event_name == 'release'
2020-07-06 16:50:26 +03:00
run: |
./.github/scripts/decrypt-secret.ps1 -filename store_fdroid-keystore.jks.gpg `
-output ./store/fdroid/keystore.jks
shell: pwsh
env:
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
- name: Compile for F-Droid Store
if: github.event_name == 'release'
2020-07-06 20:28:19 +03:00
run: |
sudo chmod +x ./.github/scripts/android/compile-fdroid.sh
./.github/scripts/android/compile-fdroid.sh
2020-07-06 16:50:26 +03:00
env:
FDROID_STORE_KEYSTORE_PASSWORD: ${{ secrets.FDROID_STORE_KEYSTORE_PASSWORD }}
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
- name: Deploy to gh-pages
if: github.event_name == 'release'
2020-07-06 16:50:26 +03:00
run: npm run deploy
2020-06-08 19:14:10 +03:00
ios:
2020-06-05 20:51:57 +03:00
runs-on: macos-latest
steps:
- name: Print environment
run: |
nuget help | grep Version
2020-06-05 21:39:29 +03:00
msbuild -version
2020-06-09 16:58:28 +03:00
dotnet --info
echo "GitHub ref: $GITHUB_REF"
echo "GitHub event: $GITHUB_EVENT"
2020-06-11 23:26:10 +03:00
env:
GITHUB_REF: ${{ github.ref }}
2020-07-06 16:50:26 +03:00
GITHUB_EVENT: ${{ github.event_name }}
2020-06-05 20:51:57 +03:00
- name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
2020-06-05 20:51:57 +03:00
2020-06-09 17:47:09 +03:00
- name: Decrypt secrets
run: ./.github/scripts/ios/decrypt-secrets.ps1
shell: pwsh
env:
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
2020-06-10 04:23:10 +03:00
- name: Increment version
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-06-10 04:23:10 +03:00
run: ./.github/scripts/ios/increment-version.ps1
shell: pwsh
2020-06-09 18:37:40 +03:00
- name: Set up keychain
run: ./.github/scripts/ios/setup-keychain.ps1
shell: pwsh
env:
KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEYCHAIN_PASSWORD }}
MOBILE_KEY_PASSWORD: ${{ secrets.IOS_KEY_PASSWORD }}
DIST_CERT_PASSWORD: ${{ secrets.IOS_DIST_CERT_PASSWORD }}
2020-06-09 19:25:09 +03:00
- name: Set up provisioning profiles
run: ./.github/scripts/ios/setup-profiles.ps1
shell: pwsh
- name: Restore packages
run: nuget restore
2020-06-10 16:03:12 +03:00
- name: Archive Build for App Store
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-06-10 16:03:12 +03:00
run: ./.github/scripts/ios/build.ps1 -configuration AppStore -platform iPhone -archive
2020-06-09 17:47:09 +03:00
shell: pwsh
- name: Build for App Store
2020-06-10 19:43:52 +03:00
if: github.ref != 'refs/heads/master'
run: ./.github/scripts/ios/build.ps1 -configuration AppStore -platform iPhone
shell: pwsh
2020-06-10 17:02:15 +03:00
- name: Export .ipa for App Store
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-06-10 17:02:15 +03:00
run: ./.github/scripts/ios/export-ipa.ps1 -method app-store
shell: pwsh
2020-06-10 17:53:57 +03:00
- name: Upload App Store .ipa artifact
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700
2020-06-10 17:53:57 +03:00
with:
2020-06-10 20:30:08 +03:00
name: Bitwarden.ipa
path: ./bitwarden-export/Bitwarden.ipa
2020-06-10 18:32:16 +03:00
- name: Deploy to App Store
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
2020-06-10 18:32:16 +03:00
run: ./.github/scripts/ios/deploy-app-store.ps1
shell: pwsh
env:
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
2020-07-06 16:55:16 +03:00
- name: Upload release assets
if: github.event_name == 'release'
run: |
hub release edit `
-a ./bitwarden-export/Bitwarden.ipa `
2020-07-06 20:28:19 +03:00
-m "Version $($env:RELEASE_TAG_NAME.TrimStart('v'))" `
2020-07-06 16:55:16 +03:00
$env:RELEASE_TAG_NAME
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}