-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (90 loc) · 2.77 KB
/
sync-translations.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Sync Translations
on:
workflow_dispatch:
push:
pull_request:
schedule:
# * is a special character in YAML so you have to quote this string
# run every day at 00:42
- cron: '42 0 * * *'
jobs:
sync-translations:
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
run: |
sudo apt-get -qq update
sudo apt-get -qq install gettext qttools5-dev-tools
- name: Checkout current repo
uses: actions/checkout@v2
- name: Checkout avogadroapp
uses: actions/checkout@v2
with:
repository: openchemistry/avogadroapp
path: openchemistry/avogadroapp
- name: Checkout avogadrolibs
uses: actions/checkout@v2
with:
repository: openchemistry/avogadrolibs
path: openchemistry/avogadrolibs
- name: Debug file layout
run: |
echo `pwd`
echo `ls -d *`
- name: Update avogadrolibs QM files
run: |
PROJECT=avogadrolibs
cd openchemistry/${PROJECT}/i18n
# generate the TS files from the PO files
echo "Generating TS"
for file in *.po; do
lconvert $file -o ${file%%.po}.ts;
done;
echo "updating TS"
for file in *.ts; do
lupdate .. -ts $file
done;
# generate the QM files from TS files
echo "Generating QM"
lrelease -compress -removeidentical *.ts
# don't keep the TS anymore
rm *.ts
echo "Renaming QM"
for file in *.qm; do
mv ${file} ${PROJECT}-${file};
done
echo `ls *.qm`
mv *.qm ${GITHUB_WORKSPACE}/${PROJECT}
- name: Update avogadroapp QM files
run: |
PROJECT=avogadroapp
cd openchemistry/${PROJECT}/i18n
# generate the TS files from the PO files
for file in *.po; do
lconvert $file -o ${file%%.po}.ts;
done;
echo "updating TS"
for file in *.ts; do
lupdate .. -ts $file
done;
# generate the QM files from TS files
lrelease -compress -removeidentical *.ts
# don't keep the TS anymore
rm *.ts
for file in *.qm; do
mv ${file} ${PROJECT}-${file};
done
mv *.qm ${GITHUB_WORKSPACE}/${PROJECT}
- name: Update git repo
uses: EndBug/add-and-commit@v7
with:
default_author: github_actions
message: Apply automatic translations
add: '*/*.qm'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
path: ${{ runner.workspace }}/*/*.qm
name: AvoI18n