Skip to content

Commit 548de56

Browse files
authored
[PM-18434] Welcome Authenticator app! (#4798)
2 parents 2893c38 + 01188c2 commit 548de56

File tree

472 files changed

+41782
-23
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

472 files changed

+41782
-23
lines changed

.github/codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ignore:
2+
- "src/test/**" # Tests
Lines changed: 280 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,289 @@
11
name: Build Authenticator
22

33
on:
4+
push:
5+
branches:
6+
- main
47
workflow_dispatch:
8+
inputs:
9+
version-name:
10+
description: "Optional. Version string to use, in X.Y.Z format. Overrides default in the project."
11+
required: false
12+
type: string
13+
version-code:
14+
description: "Optional. Build number to use. Overrides default of GitHub run number."
15+
required: false
16+
type: number
17+
distribute-to-firebase:
18+
description: "Optional. Distribute artifacts to Firebase."
19+
required: false
20+
default: false
21+
type: boolean
22+
publish-to-play-store:
23+
description: "Optional. Deploy bundle artifact to Google Play Store"
24+
required: false
25+
default: false
26+
type: boolean
27+
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
JAVA_VERSION: 17
531

632
jobs:
7-
placeholder:
8-
name: Placeholder Job
33+
build:
34+
name: Build Authenticator
35+
runs-on: ubuntu-24.04
36+
37+
steps:
38+
- name: Check out repo
39+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
40+
41+
- name: Validate Gradle wrapper
42+
uses: gradle/actions/wrapper-validation@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
43+
44+
- name: Cache Gradle files
45+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
46+
with:
47+
path: |
48+
~/.gradle/caches
49+
~/.gradle/wrapper
50+
key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }}
51+
restore-keys: |
52+
${{ runner.os }}-gradle-v2-
53+
54+
- name: Cache build output
55+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
56+
with:
57+
path: |
58+
${{ github.workspace }}/build-cache
59+
key: ${{ runner.os }}-build-cache-${{ github.sha }}
60+
restore-keys: |
61+
${{ runner.os }}-build-
62+
63+
- name: Configure JDK
64+
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
65+
with:
66+
distribution: "temurin"
67+
java-version: ${{ env.JAVA_VERSION }}
68+
69+
- name: Configure Ruby
70+
uses: ruby/setup-ruby@28c4deda893d5a96a6b2d958c5b47fc18d65c9d3 # v1.213.0
71+
with:
72+
bundler-cache: true
73+
74+
- name: Install Fastlane
75+
run: |
76+
gem install bundler:2.2.27
77+
bundle config path vendor/bundle
78+
bundle install --jobs 4 --retry 3
79+
80+
- name: Check Authenticator
81+
run: bundle exec fastlane checkAuthenticator
82+
83+
- name: Build Authenticator
84+
run: bundle exec fastlane buildAuthenticatorDebug
85+
86+
publish_playstore:
87+
name: Publish Authenticator Play Store artifacts
88+
needs:
89+
- build
990
runs-on: ubuntu-24.04
91+
strategy:
92+
fail-fast: false
93+
matrix:
94+
variant: ["aab", "apk"]
1095

1196
steps:
12-
- name: Placeholder Step
13-
run: echo "placeholder workflow"
97+
- name: Check out repo
98+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
99+
100+
- name: Configure Ruby
101+
uses: ruby/setup-ruby@28c4deda893d5a96a6b2d958c5b47fc18d65c9d3 # v1.213.0
102+
with:
103+
bundler-cache: true
104+
105+
- name: Install Fastlane
106+
run: |
107+
gem install bundler:2.2.27
108+
bundle config path vendor/bundle
109+
bundle install --jobs 4 --retry 3
110+
111+
- name: Log in to Azure
112+
uses: Azure/login@cb79c773a3cfa27f31f25eb3f677781210c9ce3d # v1.6.1
113+
with:
114+
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
115+
116+
- name: Retrieve secrets
117+
env:
118+
ACCOUNT_NAME: bitwardenci
119+
CONTAINER_NAME: mobile
120+
run: |
121+
mkdir -p ${{ github.workspace }}/secrets
122+
mkdir -p ${{ github.workspace }}/keystores
123+
124+
az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME \
125+
--name authenticator_apk-keystore.jks --file ${{ github.workspace }}/keystores/authenticator_apk-keystore.jks --output none
126+
127+
az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME \
128+
--name authenticator_aab-keystore.jks --file ${{ github.workspace }}/keystores/authenticator_aab-keystore.jks --output none
129+
130+
az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME \
131+
--name com.bitwarden.authenticator-google-services.json --file ${{ github.workspace }}/authenticator/src/google-services.json --output none
132+
133+
az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME \
134+
--name com.bitwarden.authenticator.dev-google-services.json --file ${{ github.workspace }}/authenticator/src/debug/google-services.json --output none
135+
136+
- name: Download Firebase credentials
137+
if : ${{ inputs.distribute-to-firebase || github.event_name == 'push' }}
138+
env:
139+
ACCOUNT_NAME: bitwardenci
140+
CONTAINER_NAME: mobile
141+
run: |
142+
mkdir -p ${{ github.workspace }}/secrets
143+
144+
az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME \
145+
--name authenticator_play_firebase-creds.json --file ${{ github.workspace }}/secrets/authenticator_play_firebase-creds.json --output none
146+
147+
- name: Download Play Store credentials
148+
if: ${{ inputs.publish-to-play-store }}
149+
env:
150+
ACCOUNT_NAME: bitwardenci
151+
CONTAINER_NAME: mobile
152+
run: |
153+
mkdir -p ${{ github.workspace }}/secrets
154+
155+
az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME \
156+
--name authenticator_play_store-creds.json --file ${{ github.workspace }}/secrets/authenticator_play_store-creds.json --output none
157+
158+
- name: Verify Play Store credentials
159+
if: ${{ inputs.publish-to-play-store }}
160+
run: |
161+
bundle exec fastlane run validate_play_store_json_key \
162+
json_key:${{ github.workspace }}/secrets/authenticator_play_store-creds.json }}
163+
164+
- name: Validate Gradle wrapper
165+
uses: gradle/actions/wrapper-validation@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
166+
167+
- name: Cache Gradle files
168+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
169+
with:
170+
path: |
171+
~/.gradle/caches
172+
~/.gradle/wrapper
173+
key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }}
174+
restore-keys: |
175+
${{ runner.os }}-gradle-v2-
176+
177+
- name: Cache build output
178+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
179+
with:
180+
path: |
181+
${{ github.workspace }}/build-cache
182+
key: ${{ runner.os }}-build-cache-${{ github.sha }}
183+
restore-keys: |
184+
${{ runner.os }}-build-
185+
186+
- name: Configure JDK
187+
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
188+
with:
189+
distribution: "temurin"
190+
java-version: ${{ env.JAVA_VERSION }}
191+
192+
- name: Increment version
193+
run: |
194+
DEFAULT_VERSION_CODE=$GITHUB_RUN_NUMBER
195+
VERSION_CODE="${{ inputs.version-code || '$DEFAULT_VERSION_CODE' }}"
196+
bundle exec fastlane setAuthenticatorBuildVersionInfo \
197+
versionCode:$VERSION_CODE \
198+
versionName:${{ inputs.version-name || '' }}
199+
200+
regex='versionName = "([^"]+)"'
201+
if [[ "$(cat authenticator/build.gradle.kts)" =~ $regex ]]; then
202+
VERSION_NAME="${BASH_REMATCH[1]}"
203+
fi
204+
echo "Version Name: ${VERSION_NAME}" >> $GITHUB_STEP_SUMMARY
205+
echo "Version Number: $VERSION_CODE" >> $GITHUB_STEP_SUMMARY
206+
207+
- name: Generate release Play Store bundle
208+
if: ${{ matrix.variant == 'aab' }}
209+
run: |
210+
bundle exec fastlane bundleAuthenticatorRelease \
211+
storeFile:${{ github.workspace }}/keystores/authenticator_aab-keystore.jks \
212+
storePassword:'${{ secrets.BWA_AAB_KEYSTORE_STORE_PASSWORD }}' \
213+
keyAlias:authenticatorupload \
214+
keyPassword:'${{ secrets.BWA_AAB_KEYSTORE_KEY_PASSWORD }}'
215+
216+
- name: Generate release Play Store APK
217+
if: ${{ matrix.variant == 'apk' }}
218+
run: |
219+
bundle exec fastlane buildAuthenticatorRelease \
220+
storeFile:${{ github.workspace }}/keystores/authenticator_apk-keystore.jks \
221+
storePassword:'${{ secrets.BWA_APK_KEYSTORE_STORE_PASSWORD }}' \
222+
keyAlias:bitwardenauthenticator \
223+
keyPassword:'${{ secrets.BWA_APK_KEYSTORE_KEY_PASSWORD }}'
224+
225+
- name: Upload release Play Store .aab artifact
226+
if: ${{ matrix.variant == 'aab' }}
227+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
228+
with:
229+
name: com.bitwarden.authenticator.aab
230+
path: authenticator/build/outputs/bundle/release/com.bitwarden.authenticator.aab
231+
if-no-files-found: error
232+
233+
- name: Upload release .apk artifact
234+
if: ${{ matrix.variant == 'apk' }}
235+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
236+
with:
237+
name: com.bitwarden.authenticator.apk
238+
path: authenticator/build/outputs/apk/release/com.bitwarden.authenticator.apk
239+
if-no-files-found: error
240+
241+
- name: Create checksum file for Release AAB
242+
if: ${{ matrix.variant == 'aab' }}
243+
run: |
244+
sha256sum "authenticator/build/outputs/bundle/release/com.bitwarden.authenticator.aab" \
245+
> ./authenticator-android-aab-sha256.txt
246+
247+
- name: Create checksum for release .apk artifact
248+
if: ${{ matrix.variant == 'apk' }}
249+
run: |
250+
sha256sum "authenticator/build/outputs/apk/release/com.bitwarden.authenticator.apk" \
251+
> ./authenticator-android-apk-sha256.txt
252+
253+
- name: Upload .apk SHA file for release
254+
if: ${{ matrix.variant == 'apk' }}
255+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
256+
with:
257+
name: authenticator-android-apk-sha256.txt
258+
path: ./authenticator-android-apk-sha256.txt
259+
if-no-files-found: error
260+
261+
- name: Upload .aab SHA file for release
262+
if: ${{ matrix.variant == 'aab' }}
263+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
264+
with:
265+
name: authenticator-android-aab-sha256.txt
266+
path: ./authenticator-android-aab-sha256.txt
267+
if-no-files-found: error
268+
269+
- name: Install Firebase app distribution plugin
270+
if: ${{ inputs.distribute-to-firebase || github.event_name == 'push' }}
271+
run: bundle exec fastlane add_plugin firebase_app_distribution
272+
273+
- name: Publish release bundle to Firebase
274+
if: ${{ matrix.variant == 'aab' && (inputs.distribute-to-firebase || github.event_name == 'push') }}
275+
env:
276+
FIREBASE_CREDS_PATH: ${{ github.workspace }}/secrets/authenticator_play_firebase-creds.json
277+
run: |
278+
bundle exec fastlane distributeAuthenticatorReleaseBundleToFirebase \
279+
serviceCredentialsFile:${{ env.FIREBASE_CREDS_PATH }}
280+
281+
# Only publish bundles to Play Store when `publish-to-play-store` is true while building
282+
# bundles
283+
- name: Publish release bundle to Google Play Store
284+
if: ${{ inputs.publish-to-play-store && matrix.variant == 'aab' }}
285+
env:
286+
PLAY_STORE_CREDS_FILE: ${{ github.workspace }}/secrets/authenticator_play_store-creds.json
287+
run: |
288+
bundle exec fastlane publishAuthenticatorReleaseToGooglePlayStore \
289+
serviceCredentialsFile:${{ env.PLAY_STORE_CREDS_FILE }} \

.github/workflows/crowdin-pull-authenticator.yml

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,55 @@ name: Crowdin Sync - Authenticator
22

33
on:
44
workflow_dispatch:
5+
inputs: {}
6+
schedule:
7+
- cron: '0 0 * * 5'
58

69
jobs:
7-
placeholder:
8-
name: Placeholder Job
10+
crowdin-sync:
11+
name: Autosync
912
runs-on: ubuntu-24.04
10-
13+
env:
14+
_CROWDIN_PROJECT_ID: "673718"
1115
steps:
12-
- name: Placeholder Step
13-
run: echo "placeholder workflow"
16+
- name: Check out repo
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
19+
- name: Log in to Azure - CI Subscription
20+
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
21+
with:
22+
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
23+
24+
- name: Retrieve secrets
25+
id: retrieve-secrets
26+
uses: bitwarden/gh-actions/get-keyvault-secrets@main
27+
with:
28+
keyvault: "bitwarden-ci"
29+
secrets: "github-gpg-private-key, github-gpg-private-key-passphrase"
30+
31+
- name: Generate GH App token
32+
uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1
33+
id: app-token
34+
with:
35+
app-id: ${{ secrets.BW_GHAPP_ID }}
36+
private-key: ${{ secrets.BW_GHAPP_KEY }}
37+
38+
- name: Download translations
39+
uses: crowdin/github-action@d1632879d4d4da358f2d040f79fa094571c9a649 # v2.5.1
40+
env:
41+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
42+
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
43+
with:
44+
config: crowdin-bwa.yml
45+
upload_sources: false
46+
upload_translations: false
47+
download_translations: true
48+
github_user_name: "bitwarden-devops-bot"
49+
github_user_email: "[email protected]"
50+
commit_message: "Autosync the updated translations"
51+
localization_branch_name: crowdin-auto-sync
52+
create_pull_request: true
53+
pull_request_title: "Autosync Crowdin Translations"
54+
pull_request_body: "Autosync the updated translations"
55+
gpg_private_key: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key }}
56+
gpg_passphrase: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key-passphrase }}

.github/workflows/crowdin-push-authenticator.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,29 @@ name: Crowdin Push - Authenticator
22

33
on:
44
workflow_dispatch:
5+
push:
6+
branches:
7+
- "main"
8+
env:
9+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10+
JAVA_VERSION: 17
511

612
jobs:
7-
placeholder:
8-
name: Placeholder Job
13+
crowdin-push:
14+
name: Crowdin Push
915
runs-on: ubuntu-24.04
10-
16+
env:
17+
_CROWDIN_PROJECT_ID: "673718"
1118
steps:
12-
- name: Placeholder Step
13-
run: echo "placeholder workflow"
19+
- name: Check out repo
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
22+
- name: Upload sources
23+
uses: crowdin/github-action@d1632879d4d4da358f2d040f79fa094571c9a649 # v2.5.1
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
27+
with:
28+
config: crowdin-bwa.yml
29+
upload_sources: true
30+
upload_translations: false

0 commit comments

Comments
 (0)