Skip to content

Commit dee46da

Browse files
workflow: add automation of syncing translations from Crowdin
This will poll translations from Crowdin bi-weekly, test a build to make sure that the site will compile, and then push to the main branch. This saves the effort of manually syncing translations.
1 parent dc1b0ab commit dee46da

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Import translations from Crowdin
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 1,15 * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
persist-credentials: false
16+
submodules: recursive
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
cache: npm
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Setup Crowdin CLI
28+
run: |
29+
npm i -g @crowdin/cli
30+
31+
- name: Pull from Crowdin
32+
env:
33+
CROWDIN_TOKEN: ${{ secrets.CROWDIN_TOKEN }}
34+
run: |
35+
crowdin download --branch=master
36+
37+
- name: Pull origin
38+
run: git pull origin master --ff-only # Pull origin in case a commit has been done while updating
39+
40+
# This makes sure that the site actually builds before pushing to the repo
41+
- name: Build site
42+
run: npm run docs:build
43+
44+
- name: Commit changes
45+
run: |
46+
git config user.name 'Faris NyanNyan'
47+
git config user.email 'nnfaris@flashcarts.net'
48+
49+
git checkout master
50+
git stage .
51+
git commit -m "Automatic translation import"
52+
53+
- name: Push changes
54+
uses: ad-m/github-push-action@master
55+
with:
56+
github_token: ${{ secrets.RUMIHO_TOKEN }}
57+
branch: master

0 commit comments

Comments
 (0)