From f08d415ae79248123583d6792256f2037a37f27a Mon Sep 17 00:00:00 2001 From: bl4ckscor3 Date: Tue, 21 May 2024 17:14:42 +0200 Subject: [PATCH] add crowdin workflows and update crowdin.yml --- .github/workflows/crowdin-pr.yml | 34 ++++++++++++++++++++++++++++ .github/workflows/crowdin-upload.yml | 25 ++++++++++++++++++++ crowdin.yml | 14 +++++++++--- 3 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/crowdin-pr.yml create mode 100644 .github/workflows/crowdin-upload.yml diff --git a/.github/workflows/crowdin-pr.yml b/.github/workflows/crowdin-pr.yml new file mode 100644 index 0000000000..d3eeafb8e6 --- /dev/null +++ b/.github/workflows/crowdin-pr.yml @@ -0,0 +1,34 @@ +name: Crowdin Pull Request + +on: + schedule: + - cron: '0 */1 * * *' # Every hour - https://crontab.guru/#0_*/1_*_*_* + +permissions: + contents: write + pull-requests: write + +jobs: + crowdin-pr: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Synchronize with Crowdin + uses: crowdin/github-action@v1 + with: + upload_sources: false + upload_translations: false + download_translations: true + localization_branch_name: 'l10n_1.20.4' + + create_pull_request: true + pull_request_title: 'Update translations from Crowdin' + pull_request_body: '' + pull_request_base_branch_name: '1.20.4' + commit_message: 'Update translations from Crowdin' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/crowdin-upload.yml b/.github/workflows/crowdin-upload.yml new file mode 100644 index 0000000000..c55d91140a --- /dev/null +++ b/.github/workflows/crowdin-upload.yml @@ -0,0 +1,25 @@ +name: Crowdin Upload + +on: + push: + branches: + - '1.20.4' + paths: + - '**/lang/**' + +jobs: + crowdin-upload: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Crowdin push + uses: crowdin/github-action@v1 + with: + upload_sources: true + upload_translations: true + download_translations: false + env: + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} \ No newline at end of file diff --git a/crowdin.yml b/crowdin.yml index c5e3b67b60..d4655903f6 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -1,3 +1,11 @@ -files: - - source: /**/lang/en_us.json - translation: /**/lang/%locale_with_underscore%.json +"project_id_env": "CROWDIN_PROJECT_ID" +"api_token_env": "CROWDIN_PERSONAL_TOKEN" +"base_path": "." +"base_url": "https://api.crowdin.com" +"preserve_hierarchy": true +files: [ + { + "source": "/**/lang/en_us.json", + "translation": "/**/lang/%locale_with_underscore%.json", + } +] \ No newline at end of file