[PM-24175] Refactor Crowdin workflow (#5587)

This commit is contained in:
Patrick Honkonen 2025-07-30 14:03:13 -04:00 committed by GitHub
parent 3c0818232f
commit 4a3db4fea7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 46 deletions

View File

@ -8,23 +8,12 @@ on:
jobs: jobs:
crowdin-sync: crowdin-sync:
name: Crowdin Pull - ${{ matrix.name }} - ${{ github.event_name }} name: Crowdin Pull - ${{ github.event_name }}
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
permissions: permissions:
contents: write contents: write
pull-requests: write pull-requests: write
id-token: write id-token: write
strategy:
matrix:
include:
- name: Password Manager
project_id: 269690
config: crowdin-bwpm.yml
branch: crowdin-pull-bwpm
- name: Authenticator
project_id: 673718
config: crowdin-bwa.yml
branch: crowdin-pull-bwa
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@ -60,23 +49,23 @@ jobs:
app-id: ${{ steps.get-kv-secrets.outputs.BW-GHAPP-ID }} app-id: ${{ steps.get-kv-secrets.outputs.BW-GHAPP-ID }}
private-key: ${{ steps.get-kv-secrets.outputs.BW-GHAPP-KEY }} private-key: ${{ steps.get-kv-secrets.outputs.BW-GHAPP-KEY }}
- name: Download translations for ${{ matrix.name }} - name: Download translations
uses: crowdin/github-action@b8012bd5491b8aa8578b73ab5b5f5e7c94aaa6e2 # v2.7.0 uses: crowdin/github-action@b8012bd5491b8aa8578b73ab5b5f5e7c94aaa6e2 # v2.7.0
env: env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }} CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
_CROWDIN_PROJECT_ID: ${{ matrix.project_id }} _CROWDIN_PROJECT_ID: "269690"
with: with:
config: ${{ matrix.config }} config: crowdin.yml
upload_sources: false upload_sources: false
upload_translations: false upload_translations: false
download_translations: true download_translations: true
github_user_name: "bitwarden-devops-bot" github_user_name: "bitwarden-devops-bot"
github_user_email: "106330231+bitwarden-devops-bot@users.noreply.github.com" github_user_email: "106330231+bitwarden-devops-bot@users.noreply.github.com"
commit_message: "Crowdin Pull - ${{ matrix.name }}" commit_message: "Crowdin Pull"
localization_branch_name: ${{ matrix.branch }} localization_branch_name: "crowdin-pull"
create_pull_request: true create_pull_request: true
pull_request_title: "Crowdin Pull - ${{ matrix.name }}" pull_request_title: "Crowdin Pull"
pull_request_body: ":inbox_tray: New translations for ${{ matrix.name }} received!" pull_request_body: ":inbox_tray: New translations received!"
gpg_private_key: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key }} gpg_private_key: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key }}
gpg_passphrase: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key-passphrase }} gpg_passphrase: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key-passphrase }}

View File

@ -32,27 +32,16 @@ jobs:
keyvault: "bitwarden-ci" keyvault: "bitwarden-ci"
secrets: "crowdin-api-token" secrets: "crowdin-api-token"
- name: Upload sources for Password Manager - name: Upload sources
uses: crowdin/github-action@b8012bd5491b8aa8578b73ab5b5f5e7c94aaa6e2 # v2.7.0 uses: crowdin/github-action@b8012bd5491b8aa8578b73ab5b5f5e7c94aaa6e2 # v2.7.0
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }} CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
_CROWDIN_PROJECT_ID: "269690" _CROWDIN_PROJECT_ID: "269690"
with: with:
config: crowdin-bwpm.yml config: crowdin.yml
upload_sources: true upload_sources: true
upload_translations: false upload_translations: false
- name: Log out from Azure - name: Log out from Azure
uses: bitwarden/gh-actions/azure-logout@main uses: bitwarden/gh-actions/azure-logout@main
- name: Upload sources for Authenticator
uses: crowdin/github-action@b8012bd5491b8aa8578b73ab5b5f5e7c94aaa6e2 # v2.7.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
_CROWDIN_PROJECT_ID: "673718"
with:
config: crowdin-bwa.yml
upload_sources: true
upload_translations: false

View File

@ -1,9 +0,0 @@
project_id_env: _CROWDIN_PROJECT_ID
api_token_env: CROWDIN_API_TOKEN
preserve_hierarchy: true
base_path: "authenticator/src/main"
files:
- source: "/res/values/strings.xml"
translation: "/res/values-%android_code%/%original_file_name%"
update_option: update_as_unapproved
type: android

View File

@ -2,11 +2,6 @@ project_id_env: _CROWDIN_PROJECT_ID
api_token_env: CROWDIN_API_TOKEN api_token_env: CROWDIN_API_TOKEN
preserve_hierarchy: true preserve_hierarchy: true
files: files:
- source: "/app/src/main/res/values/strings.xml"
translation: "/app/src/main/res/values-%android_code%/%original_file_name%"
dest: "/android/%original_file_name%"
update_option: update_as_unapproved
type: android
- source: "/ui/src/main/res/values/strings.xml" - source: "/ui/src/main/res/values/strings.xml"
translation: "/ui/src/main/res/values-%android_code%/%original_file_name%" translation: "/ui/src/main/res/values-%android_code%/%original_file_name%"
dest: "/android-ui/%original_file_name%" dest: "/android-ui/%original_file_name%"