Skip to content

Commit ec24b6c

Browse files
TheTonStudioIlya Egorov
authored andcommitted
Update CI (#1277)
1 parent 246f381 commit ec24b6c

File tree

26 files changed

+92
-40
lines changed

26 files changed

+92
-40
lines changed
Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,62 @@
1-
name: Sync Crowdin Translations to Release candidate
1+
name: Sync Translations
22

33
on:
44
schedule:
55
- cron: '0 * * * *'
66
workflow_dispatch:
77

88
jobs:
9-
download-translations:
9+
sync-translations:
10+
name: Sync Translations for release-candidate-${{ matrix.lang }}
1011
runs-on: ubuntu-latest
12+
1113
strategy:
1214
matrix:
13-
lang: [ru] # , en, ja, ko, zh-cn
15+
lang: [ru, ko, ja, zh-CN]
1416

1517
steps:
16-
- name: Checkout branch
17-
uses: actions/checkout@v4
18+
- name: Checkout code
19+
uses: actions/checkout@v3
1820
with:
19-
ref: release-candidate-${{ matrix.lang }}
21+
fetch-depth: 0
2022

21-
- name: Download translations from Crowdin
22-
uses: crowdin/github-action@v2
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v3
2325
with:
24-
config: crowdin-oss.yml
25-
download_translations: true
26-
download_language: ${{ github.event.inputs.language }}
27-
crowdin_branch_name: release-candidate-${{ matrix.lang }}
28-
pull_request_title: 'New Crowdin Translations'
29-
pull_request_body: 'New Crowdin translations (${{ matrix.lang }})'
30-
pull_request_base_branch_name: 'release-candidate-${{ matrix.lang }}'
31-
env:
32-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
33-
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
34-
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
35-
36-
- name: Commit and push updates
26+
node-version: '20'
27+
28+
- name: Install Crowdin CLI
29+
run: npm install -g @crowdin/cli
30+
31+
- name: Download completed translations
3732
run: |
38-
git config user.name "Crowdin Bot"
39-
git config user.email "[email protected]"
40-
git add .
41-
git commit -m "Update ${{ matrix.lang }} translations from Crowdin"
42-
git push
33+
crowdin download --export-only-approved --branch main --config crowdin-oss.yml --language=${{ matrix.lang }}
34+
35+
- name: Configure Git
36+
run: |
37+
git config user.name "github-actions[bot]"
38+
git config user.email "github-actions[bot]@users.noreply.github.com"
39+
40+
- name: Create translations branch
41+
run: |
42+
git checkout -B l10n-release-candidate-${{ matrix.lang }}
43+
44+
- name: Commit and push translations
45+
run: |
46+
git add i18n/${{ matrix.lang }}
47+
git diff --quiet --cached || ( \
48+
git commit -m "chore: update ${{ matrix.lang }} translations" && \
49+
git push -u origin l10n-release-candidate-${{ matrix.lang }} \
50+
)
51+
52+
- name: Create Pull Request
53+
uses: peter-evans/create-pull-request@v5
54+
with:
55+
token: ${{ secrets.GH_TOKEN }}
56+
commit-message: "chore: update ${{ matrix.lang }} translations"
57+
branch: l10n-release-candidate-${{ matrix.lang }}
58+
base: release-candidate-${{ matrix.lang }}
59+
title: "Update ${{ matrix.lang }} translations — release-candidate-${{ matrix.lang }}"
60+
body: |
61+
This automated PR updates only the fully translated `${{ matrix.lang }}` files.
62+
labels: translation, automated

.github/workflows/update-main.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Update main
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 1 * *'
6+
workflow_dispatch:
7+
8+
jobs:
9+
push-sources:
10+
name: Push Source Strings to Crowdin
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: '20'
23+
24+
- name: Install Crowdin CLI
25+
run: npm install -g @crowdin/cli
26+
27+
- name: Push source strings
28+
run: |
29+
crowdin push sources --branch main --config crowdin-oss.yml

crowdin-oss-ru.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

crowdin-oss.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
project_id: '798494'
2+
api_token_env: CROWDIN_PERSONAL_TOKEN
3+
preserve_hierarchy: 1
4+
5+
files:
6+
- source: i18n/en/**/*
7+
translation: i18n/%two_letters_code%/**/%original_file_name%
8+
- source: docs/**/*
9+
translation: i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name%
10+
ignore:
11+
- docs/**/*.png
12+
- source: src/pages/learn/**/*
13+
translation: i18n/%two_letters_code%/docusaurus-plugin-content-pages/learn/**/%original_file_name%

docusaurus.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ const getEnvLangConfig = () => {
2424
label: '简体中文',
2525
path: "zh-CN",
2626
},
27+
ru: {
28+
label: "Русский",
29+
path: "ru",
30+
},
2731
},
2832
};
2933
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)