From eaed73f96fdec00a51cb61c0c0f742d6e9274434 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Mon, 28 Aug 2023 21:57:04 +0700 Subject: [PATCH 1/5] ci(crowdin): init Draft specification of the action --- .github/workflows/crowdin.yml | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/crowdin.yml diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml new file mode 100644 index 0000000000..6d701fdcaa --- /dev/null +++ b/.github/workflows/crowdin.yml @@ -0,0 +1,41 @@ +name: Crowdin + +on: + push: + branches: [ dev ] + paths: + - "app/src/res/values/strings.xml" + - ".github/workflows/crowdin.yml" + schedule: + - cron: "0 0 * * *" + workflow_dispatch: + + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Crowdin action + uses: crowdin/github-action@v1 + # TODO: Move to Crowdin configuration file + with: + upload_sources: true + upload_translations: false + download_translations: true + localization_branch_name: crowdin_translations + create_pull_request: true + pull_request_title: 'chore(translation): sync translation with Crowdin' + pull_request_body: 'Lorem, foobarit:tm:!' + pull_request_labels: 'translation' + pull_request_base_branch_name: 'dev' + # TODO: add plurals.xml + source: 'app/src/res/values/strings.xml' + translation: 'app/src/res/values-%android_code%/strings.xml' + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} \ No newline at end of file From 4c94309648248406d510a3433d8682c8a617e325 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Sun, 10 Sep 2023 13:27:06 +0700 Subject: [PATCH 2/5] ci(crowdin): refactor the file Include line ending --- .github/workflows/crowdin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml index 6d701fdcaa..fb99b1b84f 100644 --- a/.github/workflows/crowdin.yml +++ b/.github/workflows/crowdin.yml @@ -38,4 +38,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} - CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} \ No newline at end of file + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} From d4987a3b2ad84915aaf6bb184f5e8ea11b11c19e Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Sun, 10 Sep 2023 13:27:45 +0700 Subject: [PATCH 3/5] ci(crowdin): update actions/checkout to v4 --- .github/workflows/crowdin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml index fb99b1b84f..5f00ea173c 100644 --- a/.github/workflows/crowdin.yml +++ b/.github/workflows/crowdin.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Crowdin action uses: crowdin/github-action@v1 From 4fa78df4fdcd74f249fcd988eb370713748117c3 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Sun, 10 Sep 2023 13:28:44 +0700 Subject: [PATCH 4/5] ci(crowdin): clarify checkout step --- .github/workflows/crowdin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml index 5f00ea173c..af6aa39916 100644 --- a/.github/workflows/crowdin.yml +++ b/.github/workflows/crowdin.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout + - name: Checkout the repository uses: actions/checkout@v4 - name: Crowdin action From 49a13ada59631a673f689f721fdb3ee5502d381a Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Sun, 10 Sep 2023 13:51:18 +0700 Subject: [PATCH 5/5] ci(crowdin): add config file, plural support --- .github/crowdin.yml | 19 +++++++++++++++++++ .github/workflows/crowdin.yml | 15 ++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 .github/crowdin.yml diff --git a/.github/crowdin.yml b/.github/crowdin.yml new file mode 100644 index 0000000000..db76da5e90 --- /dev/null +++ b/.github/crowdin.yml @@ -0,0 +1,19 @@ +project_id_env: CROWDIN_PROJECT_ID +api_token_env: CROWDIN_PERSONAL_TOKEN + +preserve_hierarchy: true + +pull_request_title: 'chore(translation): sync translation with Crowdin' +commit_message: 'chore(translation): sync translation with Crowdin' +pull_request_labels: 'translation' + +files: [ + { + source: 'app/src/res/values/strings.xml', + translation: 'app/src/res/values-%android_code%/strings.xml' + } + { + source: 'app/src/res/values/plurals.xml', + translation: 'app/src/res/values-%android_code%/plurals.xml' + } +] diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml index af6aa39916..441b3e679e 100644 --- a/.github/workflows/crowdin.yml +++ b/.github/workflows/crowdin.yml @@ -7,34 +7,27 @@ on: - "app/src/res/values/strings.xml" - ".github/workflows/crowdin.yml" schedule: - - cron: "0 0 * * *" + - cron: "0 0 * * 1" workflow_dispatch: jobs: synchronize-with-crowdin: runs-on: ubuntu-latest - steps: - name: Checkout the repository uses: actions/checkout@v4 - name: Crowdin action uses: crowdin/github-action@v1 - # TODO: Move to Crowdin configuration file with: + config: ".github/crowdin.yml" upload_sources: true upload_translations: false download_translations: true - localization_branch_name: crowdin_translations create_pull_request: true - pull_request_title: 'chore(translation): sync translation with Crowdin' - pull_request_body: 'Lorem, foobarit:tm:!' - pull_request_labels: 'translation' - pull_request_base_branch_name: 'dev' - # TODO: add plurals.xml - source: 'app/src/res/values/strings.xml' - translation: 'app/src/res/values-%android_code%/strings.xml' + localization_branch_name: "crowdin_translations" + pull_request_base_branch_name: "dev" env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}