From 4f77f12552e648e3bbd0363295ddcec6056aa52d Mon Sep 17 00:00:00 2001 From: Joseph Flinn <58369717+joseph-flinn@users.noreply.github.com> Date: Fri, 5 Nov 2021 10:59:21 -0700 Subject: [PATCH] Updating the Crowin sync process (#1144) --- .github/workflows/build.yml | 43 +++++++++++++++++++ .../{crowndin-sync.yml => crowndin-pull.yml} | 4 +- crowdin.yml | 2 + 3 files changed, 47 insertions(+), 2 deletions(-) rename .github/workflows/{crowndin-sync.yml => crowndin-pull.yml} (97%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d62376e2..19a1bc60 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1015,6 +1015,45 @@ jobs: if-no-files-found: error + crowdin-push: + name: Crowdin Push + if: github.ref == 'refs/heads/master' + needs: + - linux + - windows + - macos-package-github + - macos-package-mas + runs-on: ubuntu-20.04 + env: + _CROWDIN_PROJECT_ID: "299360" + steps: + - name: Checkout repo + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + + - name: Login to Azure + uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a + with: + creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} + + - name: Retrieve secrets + id: retrieve-secrets + uses: Azure/get-keyvault-secrets@80ccd3fafe5662407cc2e55f202ee34bfff8c403 + with: + keyvault: "bitwarden-prod-kv" + secrets: "crowdin-api-token" + + - name: Upload Sources + uses: crowdin/github-action@e39093fd75daae7859c68eded4b43d42ec78d8ea # v1.3.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }} + with: + config: crowdin.yml + crowdin_branch_name: master + upload_sources: true + upload_translations: false + + check-failures: name: Check for failures if: always() @@ -1027,6 +1066,7 @@ jobs: - macos-build - macos-package-github - macos-package-mas + - crowdin-push steps: - name: Check if any job failed if: ${{ (github.ref == 'refs/heads/master') || (github.ref == 'refs/heads/rc') }} @@ -1038,6 +1078,7 @@ jobs: MACOS_BUILD_STATUS: ${{ needs.macos-build.result }} MACOS_PKG_GITHUB_STATUS: ${{ needs.macos-package-github.result }} MACOS_PKG_MAS_STATUS: ${{ needs.macos-package-mas.result }} + CROWDIN_PUSH_STATUS: ${{ needs.crowdin-push.result }} run: | if [ "$CLOC_STATUS" = "failure" ]; then exit 1 @@ -1053,6 +1094,8 @@ jobs: exit 1 elif [ "$MACOS_PKG_MAS_STATUS" = "failure" ]; then exit 1 + elif [ "$CROWDIN_PUSH_STATUS" = "failure" ]; then + exit 1 fi - name: Login to Azure - Prod Subscription diff --git a/.github/workflows/crowndin-sync.yml b/.github/workflows/crowndin-pull.yml similarity index 97% rename from .github/workflows/crowndin-sync.yml rename to .github/workflows/crowndin-pull.yml index c86203af..55d0c8ee 100644 --- a/.github/workflows/crowndin-sync.yml +++ b/.github/workflows/crowndin-pull.yml @@ -4,8 +4,8 @@ name: Crowdin Sync on: workflow_dispatch: inputs: {} -# schedule: -# - cron: '0 0 * * *' + schedule: + - cron: '0 0 * * 5' jobs: crowdin-sync: diff --git a/crowdin.yml b/crowdin.yml index 27f37177..8ea20348 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -1,7 +1,9 @@ project_id_env: _CROWDIN_PROJECT_ID api_token_env: CROWDIN_API_TOKEN +preserve_hierarchy: true files: - source: /src/locales/en/messages.json + dest: /src/locales/en/%original_file_name% translation: /src/locales/%two_letters_code%/%original_file_name% update_option: update_as_unapproved languages_mapping: